JavaScript jQuery Basics Introducing jQuery Blog Previewer: Getting Values from Form Fields

jQuery arrow functions

Can we use arrow function and event object with jQuery? For example:

$('.selectedElement').on('click', (e) => {
  console.log(e.target);
});

1 Answer

Steven Parker
Steven Parker
195,302 Points

Sure, and when you pass a single parameter to an arrow function, you don't need to put parentheses around it.