Using 'this' instead of 'event.currentTarget'

In one of the JQuery lessons, following was expected:

$(document).ready(() => {

  $('.product-photo').on('mouseenter', event => {
  }).on('mouseleave', event => {

Why $(this).addClass(‘photo-active’) does not work instead of $(event.currentTarget).addClass(‘photo-active’) ?

It is was i suspected:

but its a pity this answer doesn’t go into how the binding is different.

Its explained here:

this binds differently when using arrow syntax.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.