返回值: Elementevent.delegateTarget
V1.7概述
当currently-called的jQuery事件处理程序附加元素。
此属性是最经常有用是通过过.on(), where the event handler is attached at an ancestor of the element being processed. It can be used, for example, to identify and remove event handlers at the delegation point.
对于非授权的事件处理程序,直接连接到一个元素,event.delegateTarget 总是等价于event.currentTarget.
示例
描述:
When a button in any box class is clicked, change the box's background color to red.
jQuery 代码:
$(".box").on("click", "button", function(event) {
$(event.delegateTarget).css("background-color", "red");
});