Is it possible to change the name ‘jQuery’ in jquery’s source code to something else.
I want to perform my jQuery operations with this new name.
eg:
jQuery('#something').attr(); to
myName('#something').attr();
How do I do this?
Is it possible to change the name ‘jQuery’ in jquery’s source code to something
Share
This will restore both
$andjQueryto whatever value (possiblyundefined) they had before and assign the jQuery object tomyName.However, consider wrapping your code using jQuery in a closure where
$points to the jQuery object:People who work with your code expect
$to be used and will most likely be annoyed if they have to use something else; especially if it’s something longer!If you do not need to remove
$andjQuery, do not usejQuery.noConflict(true)but simply writejQueryat the places where I usedjQuery.noConflict(true).Also remember that no jQuery plugins will work if you remove the global
jQuerybefore loading them (doing so after they are loaded is fine if they have been written properly, i.e. with the closure I suggested to you)