You can check the version with $().jquery. You can remove all instances of jquery from the current page using something like this: if(jQuery) $('script[src^=jquery]').remove();
There is also the noConflict method which might help. On Apr 10, 1:44 pm, "ihomest...@gmail.com" <ihomest...@gmail.com> wrote: > Hi, > > Is there a way to avoid loading jquery multiple times? I have some > javascript code which needs to use jquery and at the same time. This > script is embeded in others' web site. > > One way I could do is to check and then decide whether to load jquery: > > if (typeof jQuery != 'undefined') { > // do something > > } > > If jQuery is defined then I know for sure that it is loaded. But the > loaded version might be the same one my javascript needs. Is there a > good way to solve this problem? > > Does jQuery allows the use of namespace? For example, even though > jquery is loaded by other scripts but could I load a new jQuery again > into a separate namespace without breaking the loaded jQuery version? > If this is allowed, I could just always load the right jquery into my > own namespace and use all the functions my javascript needs. > > Any ideas? > > Thanks.