| Welcome to WebmasterWorld Guest from 22.214.171.124 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro 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?
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.
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.
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.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved