0Pricing
JavaScript Academy · Lesson

preventDefault and stopPropagation

Control default behavior and bubbling.

Controlling Event Behavior

Two mechanisms let you control events: stopping the browser’s default action and stopping the event from traveling through the DOM.

Default Actions

Many elements have built-in default behaviors: links navigate, form submits reload, checkboxes toggle. These happen unless you intervene.

All lessons in this course

  1. addEventListener Basics
  2. The Event Object
  3. preventDefault and stopPropagation
  4. Keyboard and Mouse Events
← Back to JavaScript Academy