Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

using jQuery.noConflict()



2:57 pm on Feb 2, 2012 (gmt 0)

10+ Year Member

I just discovered jQuery.noConflict() and have some questions about its use.

If I put it on my main page, then later reference an external script, do I need to use jQuery.noConflict() in that script too, or does the main page take care of it?

A more general question is: are external scripts basically independent of the calling page except for direct function calls to them?


4:32 am on Feb 4, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

All scripts shares the global namespace, so no independence, that said good practice minimizes use of this namespace. jQuery only uses $ and jQuery I think.

jQuery.noConflict() needs to be called after jQuery installed to undo $ assignment, hopefully nothing else changes it, or other library script is executed prior to this call.


12:10 pm on Feb 4, 2012 (gmt 0)

10+ Year Member

I don't understand what you mean by "good practice minimizes use of this namespace". Give me an example using jQuery.noConflict() that achieves this.


2:08 am on Feb 5, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

See [svennerberg.com...] or search "global variables javascript".

Take the jQuery function inArray as an example, there could have placed it in the global namespace such that you would call


instead it is within the jQuery object


and will not conflict with other libraries offering similar function.

Featured Threads

Hot Threads This Week

Hot Threads This Month