[jQuery] Problems with embedded scripts

[jQuery] Problems with embedded scripts

Thanks for the suggestion ... The original problem wasn't that the <script> wasn't running - rather it was never inserted in the DOM by MSIE.
A pseudocode format of the original page before the AJAX call is:
<body>
    <div>
    </div>
    <!-- more html content -->
</body>
For whatever reason, when AJAX is used to load HTML inside the <div> so that the resulting page looks like:
<body>
    <div>
        <div>
            <script>
                <!-- script content -->
            </script>
            <!-- html content -->
        </div>
    </div
    <!-- more html content -->
</body>
... -IE 6.x does not add the script to the DOM, and thus never runs. (Yet another IE bug?) If I change the returned HTML so that the resulting page looks like:
<body>
    <div>
        <div>
            <!-- html content -->
        </div>
        <script>
            <!-- script content -->
        </script>
    </div>
    <!-- more html content -->
</body>
... then the <script> is added to the DOM, and runs properly. :-)
________________________________________
From: discuss-bounces@jquery.com [mailto:discuss-bounces@jquery.com]
Sent: September 8, 2006 3:50 PM
To: jQuery Discussion.
Subject: Re: [jQuery] Problems with embedded scripts
The script is running before the submit button is created, and as a result is trying to attach the click event to an element that doesn't exist. You should wrap the code in
$(function(){ .... }); (==   $(document).ready(function() { .... });  )
So that it gets run once the document has finished loading.
Blair