Script to be executed in a Div loaded by Ajax <p>I'm using AJAX to load an HTML page inside a <code>div</code>, but this page has scripts that don't work if I load the AJAX code using the click function. The problem is that I need the page to execute the scripts when I click some specific button.</p> <p>The code that works, but load with main page, not when I click the button:</p> <pre><code>$('document').ready(function(){ $.ajax({ url: "primeiro/index.html", }).done(function (data) { $("#curso").html(data); $('#curso').each(function (index, element) { eval(element.innerHTML); }); }); }); </code></pre> <p>I change to this:</p> <pre><code>$('document').ready(function(){ $("#loginsb").click(function () { $.ajax({ url: "primeiro/index.html", }).done(function(data) { $("#curso").html(data); $('#curso').each(function(index, element) { eval(element.innerHTML); }); }); }); }); </code></pre> <p>Then the page seems to be "paused", so, can't load the script.</p> <p>How can I use the click (in <code>#loginsb</code> button) function to load the content inside my <code>div</code>?</p> <p>Thanks!</p>