Home >Web Front-end >JS Tutorial >Example of usage of unbind() method in jQuery_jquery

Example of usage of unbind() method in jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 16:19:26899browse

The example in this article describes the usage of the unbind() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This method removes event handlers for the selected element, including custom events registered through the bind() method.
The unbind() method without parameters deletes all bound events.
This method, if an event type is provided as a parameter, only removes bound events of that type.
If a handler is passed as the second argument when binding, only that specific event handler will be removed.

Grammar structure:

Copy code The code is as follows:
$(selector).unbind(type, function)

Parameter list:

参数 描述
data 要被解绑的事件类型。
Function 要从每个匹配元素的事件中解绑的事件处理函数。

实例代码:

复制代码 代码如下:






脚本之家









以上代码可以删除在div上注册的事件处理函数。

希望本文所述对大家的jQuery程序设计有所帮助。

Statement:
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