Place the code into a function and then call that function immediately
after the HTML is injected.
L
Benjam Welker wrote:
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
--
Regards,
Liam
------------------------------------------------------------------------
Liam Byrne
*OnSight.ie
*/Winner of Limerick City Enterprise Board's "Best New Technology
Business 2004" Award
/
web: http://www.onsight.ie email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
phone: 061 22 99 86
mobile:087 2730 270