Ajax learning notes-$ usage

Source: Internet
Author: User
Javascript is an object-oriented language. The objects here are different functions.

VaR jquery = Window. jquery = Window. $ = function (selector, context)

{

//...

// Other internal initialization code goes here

};

You need to know that jquery, window. jquery, window. $ or simply $ can be used interchangeably, because as the Declaration stated in the code block abve tells us, it refers to the same object in memory.

$ Is just an identifier. In many JavaScript frameworks, it is used to point to some major classes.CodeIs not recommended.
[Example] var $ = jqeury; [/example]

$ Is a type of method defined by prototype.

$ ("ID") is the element with the page ID as "ID ".
$ F ("ID") returns the value of the element whose page ID is "ID". This is read-only and cannot be written.

 

$ () Is a document that is used too frequently in the Dom. A convenient shorthand for the getelementbyid () method. Like this Dom method, this method returns the element of the ID passed in by the parameter.

 

This is better than the DOM method. You can input multiple IDS as parameters and then $ () returns an array object with all the required elements.

 

The $ F () method is another popular shorthand. It returns the value of any input form control, such as a text box or a drop-down box. This method can pass in the element ID or element itself.

 

Source: xuewang (www.xue5.com), original address: http://www.xue5.com/itedu/200802/102501.html

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.