People who have used jquery know that there are two ways to use jquery, one is $, and one is jquery, so what's the difference between the two?
The answer is that the two usages are no different, just aliases, with $ to be shorter and easier than jquery, and other front-end frames are also used in the $ symbol, if you want to not conflict with other frameworks, we recommend the use of jquery.
Another way is to change a new abbreviation:
1. Call the Noconflict function of jquery
[HTML]View PlainCopy
- Jquery.noconflict ();//Let jquery abandon the use of the $, to other JS framework used
2. Declaring a new abbreviation
[HTML]View PlainCopy
- var $j = Jquery
Use $J instead of $ to prevent naming conflicts.
The difference between $ and $ ():
$ (' #abc ') is required to invoke methods that do not need to manipulate objects (such as static methods in Java code, which can be manipulated without declaring objects), such as $.prototype, if you are assigning values to an object (note that there are operands here). Val (' 123 ') way, Because $ (this) is used in methods such as Val () to manipulate the current object.
The difference between $ and jquery and $ () in jquery