Jquery 1.4.2 released! Mainly performance and API

Source: Internet
Author: User

Performance: see


Download the latest jquery 1.42 framework
You can also directly introduce the following in the webpage:
Http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js
Http://ajax.microsoft.com/ajax/jQuery/jquery-1.4.2.min.js
Add method:
. Delegate (selector, eventtype, Handler)
This function is indeed very useful. Attaches an event listener to a specified object.

Selector: Selector

Eventtype: Event Type

Handler: Listener Function

The delegate method is used to replace the. Live () method in 1.3.2. This method is more convenient than live, and can also be used to dynamically add events.

Let's look at the following example: bind a hover event to each TD in the table
The previous statement is as follows:

CopyCode The Code is as follows: $ ("table"). Each (function (){
$ ("TD", this). Live ("hover", function (){
$ (This). toggleclass ("hover ");
});
});

As long:Copy codeThe Code is as follows: $ ("table"). Delegate ("TD", "hover", function (){
$ (This). toggleclass ("hover ");
});

One line of code.

Of course, since there is. Delegate (), there is also. undelegate (), used to unbind the event

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.