What does event.preventDefault() do?

JavaScript Associate Easy

JavaScript Associate — Easy

What does event.preventDefault() do?

Key points

  • event.preventDefault() specifically targets the default action of the event
  • It does not stop event propagation to parent elements
  • Other event listeners on the element will still be triggered

Ready to go further?

Related questions