Skip to content Skip to sidebar Skip to footer

"this" Keyword Behaves Differently When Using Arrow Functions With Jquery Callbacks

I have a table with multiple rows, and on each row, there is an edit and delete button. In short, when an edit button is triggered with class .edit, a form pops-up. Along with th

Solution 1:

this in normal functions resolves to the object that calls the function, so in this case, this is the element that is clicked on.

this in arrow functions does not define its own this, instead the this value of the enclosing execution context is used.

It won't work with arrow functions in this case. You'll have to stick to bog standard functions.

Post a Comment for ""this" Keyword Behaves Differently When Using Arrow Functions With Jquery Callbacks"