Analysis of jquery framework and construction object

Source: Internet
Author: User

This is some text that analyzes the jquery framework

For jquery 1.3.2 version

Readers should have the following requirements

1. Very familiar with HTML

2. Very familiar with JavaScript grammar knowledge

3. Familiarity with JavaScript-oriented object-oriented knowledge

4. Proficiency in using the jquery framework

Anyway

The initialization of a jquery object is written in an anonymous function.

Just like this:

(function(){alert("jQuery框架分析")})();

The first bracket is the declaration of a function, and the second parenthesis is the execution of this function. That is, the jquery framework has done something when the page was loaded (this anonymous function has been executed). These things are done so that we can get the page elements through $ ("#yourId") or $ (". YourClass"), and wrap the acquired elements into jquery objects.

How does an anonymous function implement these functions?

First, the framework defines two core objects

jQuery = window.jQuery = window.$ = function(  selector, context ) {}

One is jquery.

One is $

Both of these objects point to a function

This function is the entry that we use for the $ () or jquery () method, which returns an instance of JQuery.fn.init (selector, context), in fact this instance is a jquery object.

What kind of object is a jquery object?

The jquery object is actually an array of javascript

This array object contains 125 methods and 4 properties

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.