I am appending the jQuery library to the dom using:
var script = document.createElement('script');
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
However when I run:
jQuery(document).ready(function(){...
The console reports the error:
Uncaught ReferenceError: jQuery is not defined
How do I load jQuery dynamically as well as use it once it is in the dom?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…