Return to Snippet

Revision: 28330
at August 6, 2010 03:34 by brandonjp


Updated Code
/* I used to use (!$) or ($ == undefined) but that doesn't work sucka! */

if (!window.jQuery) {
	var jqscript = document.createElement('script');
	jqscript.setAttribute("type", "text/javascript");
	jqscript.setAttribute("src", "http://code.jquery.com/jquery.min.js");
	document.getElementsByTagName("head")[0].appendChild(jqscript);
};

Revision: 28329
at July 7, 2010 03:54 by brandonjp


Updated Code
function jQueryLoader() {
	var jqscript = document.createElement('script');
	jqscript.setAttribute("type", "text/javascript");
	jqscript.setAttribute("src", siteScripts.jqueryScript);
	document.getElementsByTagName("head")[0].appendChild(jqscript);
};



if (!$) {
	jQueryLoader();
	
}

Revision: 28328
at July 7, 2010 03:53 by brandonjp


Initial Code
function jQueryLoader() {
	var jqscript = document.createElement('script');
	jqscript.setAttribute("type", "text/javascript");
	jqscript.setAttribute("src", siteScripts.jqueryScript);
	document.getElementsByTagName("head")[0].appendChild(jqscript);
};








if (!$) {
	jQueryLoader();
	
}


Initial URL


Initial Description


Initial Title
js - jQuery - jQueryLoader - check if $ is undefined, then load jquery with pure javascript if needed

Initial Tags
javascript, js, textmate, jquery, load

Initial Language
jQuery