Removing the script elements won't do anything, the code has already
been executed. You can simply use 'delete jQuery; delete $;' for
example.

Having multiple jQuery instances is not a great idea either for
performance or code clarity purposes. But a possible approach is to
create an iframe and load jQuery in it, that would eliminate any
possibility of conflict and you could use it normally, just taking
care of passing the correct document context everytime.


On Apr 10, 3:53 pm, jay <jay.ab...@gmail.com> wrote:
> 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.

Reply via email to