[jQuery] Dynamically loading scripts

[jQuery] Dynamically loading scripts

> $("head").append('<script type="text/javascript" src="script_b.js"
class="current"></script>');
It's not IE's fault.
What you're doing ends up being invalid, but Firefox and Opera are letting
it slide.
append() uses the underlying DOM appendChild() function, which does not take
HTML, but takes a DOM element. So jQuery creates a wrapper DIV, sets its
innerHTML to your HTML, then does the appendChild with that wrapper DIV.
Can you put a DIV in HEAD? :-)
Instead, you need to create a DOM script element and append that.
-Mike
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/














    • Topic Participants

    • mike