Is event.currentTarget always equal to $(this) in jQuery?

前端 未结 3 813
失恋的感觉
失恋的感觉 2021-02-13 19:29

Is this phrase always true?

$(\"p\").click(function(event) {
  alert( event.currentTarget === this ); 
});  

Is one method preferred over the o

3条回答
  •  失恋的感觉
    2021-02-13 19:55

    This property will typically be equal to the this of the function.

    If you are using jQuery.proxy or another form of scope manipulation, this will be equal to whatever context you have provided, not event.currentTarget

提交回复
热议问题