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 the other is jquery, so what's the difference between the two?

The answer is that the two methods are no different, just aliases , with $ to be shorter and more convenient than jquery, and other front-end frames are also used in the $ symbol, if you want to not conflict with other frameworks, it is recommended to use the JQuery method.

Another way is to change a new abbreviation:

1. Call the Noconflict function of jquery

Jquery.noconflict ();//Let jquery abandon the use of the $, to other JS framework used
2. Declaring a new abbreviation

Use $J to replace $ 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 an object), such as $.prototype, if you assign a value to an object ( Note that there are operands here ). Val (' The 123 '), as the method in Val () will use $ (this) to manipulate the current object.

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

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.