您可以解除绑定以前的事件处理程序并仅附加所需的事件处理程序.
element.unbind(event).bind(event,eventHandler);
Run Code Online (Sandbox Code Playgroud)
这是一种做法
$("#test").click(function() { alert('hello'); return false; });
// Before the last event handler.
$("#test").unbind("click");
$("#test").click(function() { alert('world'); return false; });
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
565 次 |
| 最近记录: |