jQuery中on函数用法:
on函数用于指定某个事件的监听函数,语法如下:
$(selector).on(event,childSelector,data,function,map)
其中selector和childSelector分别为选择器,用于指定事件所监听的DOM节点,event参数为要监听的事件名称,data参数为可选的数据参数,function为事件触发时的处理函数,map参数可以对应一个对象,用于替换函数参数e。
例如:
$("#testID").on("click", "p", {"name":"jquery","time":"2017"}, function(e){
console.log("name=" + e.data.name + " time=" + e.data.time);
});