[jQuery] jQuery runs inserted scripts prior to inserting HTML

[jQuery] jQuery runs inserted scripts prior to inserting HTML


I posted about this yesterday, but it never showed up...
I have a script that grabs some HTML (with included javascript) via AJAX
and injects the HTML into the page. The problem is that the scripts
within that HTML block get executed before the HTML that it is
referencing is inserted into the page (and therefore missing from the DOM).
How can I pause execution of the script until the HTML is fully inserted
into the DOM?
The script is located in the HTML after the HTML it is referring to...
e.g.-
form
input id=a
script for element with id=a
/form
When I move the scripts below the form tag, the script executes as it
should and everything works.
But this method is a work-around, and I'd rather not do it this way.
~Benjam