Using jquery on pit method to register an event encountered

1, on registered events

  $(selector).on(event,childSelector,data,function)

2, $ (selector) in the selector can be document, it means that the event will childSelector registered mounted on the document, because the document is the parent of all nodes.

3, if you want to use the unbound OFF () function

  $(selector).off(event,selector,function(eventObj),map)

event 必需。规定要从被选元素移除的一个或多个事件或命名空间。

由空格分隔多个事件值。必须是有效的事件。
selector 可选。规定添加事件处理程序时最初传递给 on() 方法的选择器。(也就是使用on函数注册时childSelector
function(eventObj) 可选。规定当事件发生时运行的函数。(一个selector上可以注册多个相同事件但不同执行函数,可以指定解绑指定的处理函数
map 规定事件映射 ({event:function, event:function, ...}),包含要添加到元素的一个或多个事件,以及当事件发生时运行的函数。

Guess you like

Origin www.cnblogs.com/lirenhe/p/11797042.html