What is jQuery noconflict ?
Its basically a way to tell jQuery to relinquish its control on $ or jQuery.
During its initialization it saves the existing values of $ / jQuery in current Window Scope.
var _jQuery = window.jQuery;
var _$ = window.$,
if $ / jQuery already in use prior to inclusing of jQuery script, _jQuery / _$ will now store the existing values.Otherwise these variables are undefined.
In case of already in use if noconflict is not called, $/jQuery will point to jQuery object, thus losing the values of $/jQuery prior to inclusion of jQuery js file.
If you want jQuery not to interfere with old values of $ then call noConflict.
Its basically a way to tell jQuery to relinquish its control on $ or jQuery.
During its initialization it saves the existing values of $ / jQuery in current Window Scope.
var _jQuery = window.jQuery;
var _$ = window.$,
if $ / jQuery already in use prior to inclusing of jQuery script, _jQuery / _$ will now store the existing values.Otherwise these variables are undefined.
In case of already in use if noconflict is not called, $/jQuery will point to jQuery object, thus losing the values of $/jQuery prior to inclusion of jQuery js file.
If you want jQuery not to interfere with old values of $ then call noConflict.
No comments:
Post a Comment