The difference between $ and jquery and $ () in jquery

Source: Internet
Author: User

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
    1. Jquery.noconflict ();//Let jquery abandon the use of the $, to other JS framework used

2. Declaring a new abbreviation

[HTML]View PlainCopy
    1. 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.