当currently-called的jQuery事件处理程序附加元素。
此属性是最经常有用是通过过.delegate()或.on()附加委派的事件,事件处理程序附加在正在处理的元素的祖先上。它可用于,例如,指明委派识别和删除事件处理程序。 This property is most often useful in delegated events attached by .delegate()or .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.
$(".box").on("click", "button", function(event) {
$(event.delegateTarget).css("background-color", "red");
});
备案信息: 粤ICP备15087711号-2
Copyright © 2008-2024 啊嘎哇在线工具箱 All Rights.
本站所有资料来源于网络,版权归原作者所有,仅作学习交流使用,如不慎侵犯了您的权利,请联系我们。