This article mainly introduces the usage of the die() method injQuery. The example analyzes the function, definition and removal of all the die() method added to the specified element through the live() method. For tips on using multipleevent handlingprograms, friends in need can refer to
This article explains the usage of the die() method in jQuery with examples. Share it with everyone for your reference. The specific analysis is as follows:
This method removes all one or more event handlers added to the specified element through the live() method.
Syntax structure:
$(selector).die(type,function)
Parameter list:
实例代码:
概述
从元素中删除先前用.live()绑定的所有事件.(此方法与live正好完全相反。)
如果不带参数,则所有绑定的live事件都会被移除。
你可以解除用live注册的自定义事件。
如果提供了type参数,那么会移除对应的live事件。
如果也指定了第二个参数function,则只移出指定的事件处理函数。
参数
type[,fn] String,FunctionV1.3
type:要移除的一个或多个事件处理程序。由空格分隔多个事件值。必须是有效的事件。
fn:要移除的函数。。
type StringV1.4.3
要移除的一个或多个事件处理程序。 由空格分隔多个事件值。必须是有效的事件。
示例
描述:
给按钮解除click事件
jQuery 代码:
function aClick() { $("div").show().fadeOut("slow"); } $("#unbind").click(function () { $("#theone").die("click", aClick) });
The above is the detailed content of jQuery: Detailed explanation of the use of die(). For more information, please follow other related articles on the PHP Chinese website!