Home > Web Front-end > JS Tutorial > body text

Duplicate binding instructions for live methods in jQuery_jquery

WBOY
Release: 2016-05-16 18:00:34
Original
973 people have browsed it

Solution: Use the die() method to unbind all previously bound events on this element before binding the live() method, and then bind new events through the live() method.

Copy code The code is as follows:

//First release through the die() method , and then bind through live()
$("#selectAll").die().live("click",function(){
//Event running code
});

die() method introduction:
Copy code The code is as follows:

die([type], [fn])

Overview
New in jQuery 1.3. This method is exactly the opposite of live.

If no parameters are provided, all bound live events will be removed.

You can cancel custom events registered with live.

If the type parameter is provided, the corresponding live event will be removed.

If the second parameter function is also specified, only the specified event handling function will be removed.
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