Home > Web Front-end > JS Tutorial > jquery 1.4.2 released! Mainly performance and API_jquery

jquery 1.4.2 released! Mainly performance and API_jquery

WBOY
Release: 2016-05-16 18:33:49
Original
986 people have browsed it

Performance: See the picture below


Jquery 1.42 latest version framework download
You can also introduce it directly into the web page:
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
New method:
.delegate( selector, eventType, handler )
This function is indeed very useful. Used to attach an event listener to the specified object.

selector: selector

eventType: event type

handler: listening function

Delegate This method is used to replace .live( in 1.3.2 )method. This method is more convenient than live, and can also achieve the function of dynamically adding events.

Look at the following example: bind hover events to each td of the table
The previous writing was as follows:

Copy code The code is as follows:

$("table").each(function(){
$("td", this).live("hover", function( ){
$(this).toggleClass("hover");
});
});

Now just do this:
Copy code The code is as follows:

$("table").delegate("td", "hover", function() {
$(this).toggleClass("hover");
});

One line of code to do it

Of course, since there is .delegate(), there is also. unelegate(), used to unbind events
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template