The code doesn't work because you are loading jQuery dynamically, so it is executed *after* your plugins which are loaded with inline script tags.
I would do it like this: <script type="text/javascript"> function script( url ) { document.write( '<script type="text/javascript" src="', url, '">', '<\/script>' ); } if( ! jQuery ) script( 'jquery-1.2.6.min.js' ); script( 'firstplugin.js' ); script( 'secondplugin.js' ); </script> By doing everything with document.write, you will get the execution order you want. -Mike > I am struggling to test if a jQuery reference exists yet on a > page, and if it does continue loading my jQuery plugins. > However, if it does not, I wish to add the jQuery reference, > and continue loading my jQuery plugins only after the jQuery > script has loaded. > > Below is a snippet of what I've tried (which does not work). > This code is in the body tag of my page, and my specific > problem is detecting if a page has already loaded jQuery into > the header. > Thanks! > > <body> > <div id="global_menu"> > <script language="JavaScript" type="text/javascript"> > if (!jQuery) > { > //alert("jQuery NOT loaded"); > var script = document.createElement('script'); > script.type = 'text/javascript'; > script.src = 'jquery-1.2.6.min.js'; > document.getElementsByTagName('head')[0].appendChild(script); > } > </script> > <!-- many other jQuery plugins are referenced here, too --> > <script type="text/javascript" > src="http://www.elon.edu/e-net/ Scripts/menu/jquery.jdMenu.js" /> > <!-- menu source removed for brevity --> </div> </body> >