I want to create a script tag by jQuery.
I use the following code:
$("<body>").append("<script></script>");
It doesn't work. What will you do to achieve it?
I want to create a script tag by jQuery.
I use the following code:
$("<body>").append("<script></script>");
It doesn't work. What will you do to achieve it?
You should do it like so
var script=document.createElement('script');
script.type='text/javascript';
script.src=url;
$("body").append(script);
Why are you not using jQuery.getScript(url,[callback])?
getScript() can do everything that's possible with creating script tags. And if it is, the answer would be much better if it actually stated that.