Skip to main content

How to execute Jquery-code in a dialog which received its content via $.get



Let's say the following code exists in template_A popping up a dialog which displays content from template_B.





The html is presented fine in the dialog but unfortunately any javascript included in template_B does not run.





Jquery & Jquery-ui are included in template_A.





template_B has no javascript-includes as it is represented by a div belonging to template_A.





JS in template_A :







var win = $(document.createElement('div'));

$.get(url, function (html) {

win.html(html);

win.dialog("open");

});







template_B :







<div id="content">



<script type="text/javascript">

$(function () {

// this never executes,

// js-debugging won't enter this part...

});

</script>



</div>




Comments