I have initializor.js which contains the following:
if(typeof jQuery=='undefined') { var headTag = document.getElementsByTagName("head")[0]; var jqTag = document.createElement('script'); jqTag.type = 'text/javascript'; jqTag.src = 'jquery.js'; headTag.appendChild(jqTag); }
Then I include this file somewhere on another page. The code checks to see if jQuery is loaded, and if not, add it to the Head tag.
However, jQuery is not initialized because in my main document I have several events declared only to verify this. I also tried writing jQuery code below validation, and Firebug said that "jQuery is undefined". Is there any way to do this? Firebug shows jquery inclusion tag in title tag!
Also, can I dynamically add code to the $ (document) .ready () event? Or didn't you just need to add some Click events to multiple elements?
javascript jquery dynamic
Jeff Jul 25 2018-11-11T00: 00Z
source share