$("#test1").on('click', function(e) {
$(this).text('触发事件:' + e.type)
})
$("#test2").on('mousedown mouseup', function(e) {
$(this).text('触发事件:' + e.type)
})
$("#test3").on({
mousedown: function(e) {
$(this).text('触发事件:' + e.type)
},
mouseup: function(e) {
$(this).text('触发事件:' + e.type)
}
})
on()的高级应用
$("div").on("click","p",fn)
div中的p都绑定了click事件。