Executing script inside a dynamically loaded div

Executing script inside a dynamically loaded div

Hello all,

I'm extracting a div from some large HTML that contains normal HTML and scripts.

If I use e.g.

  1. $div.replaceWith($newDiv);

...the scripts don't get executed.  Same with html($newDiv.html())

How can I get the scripts to execute?


Thanks in advance and kind regards