jQuery .load from another page that contains Javascript
<p>I've been using jQuery .load() to load content into a div.  The content being .loaded occasionally has a document.ready() function which is called, and works, correctly (i.e. the ready() function is called).  However, when I use an element ID in the .load(), such as:  .load ("test.php #content"), the Javascript is no longer executed even if I put the script tag inside of the element that is being loaded.  Does anyone have a solution to this other than to not use the element ID in the .load()?  Thanks in advance.</p>

<p>Here is the dynamic content (loadDialogTest.php):</p>

<pre><code>    &lt;div id="test"&gt;
        &lt;div&gt;
         Hello, World!
        &lt;/div&gt;


        &lt;script type="text/javascript"&gt;
            $(document).ready (function () {
                alert ("ready");
            });
        &lt;/script&gt;
    &lt;/div&gt;
</code></pre>

<p>and here is the page (where the element ID is NOT specified) that loads it (shortened as much as possible while maintaining the form:</p>

<pre><code>    &lt;head&gt;
        &lt;script type="text/javascript"&gt;
            $(document).ready (function () {
                $("#openDialog").click (function () {
                    $("&lt;div&gt;&lt;/div&gt;")
                        .load ("loadDialogTest.php")
                        .appendTo ($("#containingDiv"))
                        .dialog ({
                        autoOpen: 'false',
                        title: 'Test This!',
                        close: function () {
                            $(this).dialog ('destroy').remove ();
                        }
                    });
                });
            });
        &lt;/script&gt;
    &lt;/head&gt;

    &lt;body&gt;
        &lt;a href="#" id="openDialog"&gt;Open it&lt;/a&gt;

        &lt;div id="containingDiv"&gt;
        &lt;/div&gt;
    &lt;/body&gt;
</code></pre>

<p>If I put #test after the .php file as the div to load, the jQuery ready() function is no longer called.</p>
