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

Piotr Manczak
Piotr Manczak
Front End Web Development Techdegree Graduate 20,656 Points

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
177,523 Points

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