Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up

What does preventDefault() do on an event object?

  1. A Stops the event from bubbling to ancestors
  2. B Cancels the browser's default action for that event
  3. C Removes the event listener
  4. D Prevents other handlers from running
Answer

Cancels the browser's default action for that event

preventDefault stops the default behaviour such as following a link or submitting a form. stopPropagation is the separate method that halts bubbling.

All Javascript MCQs

Login to manage your account

Please enter a valid email address.
Forgot Password?
Please enter a valid password.
OR

Don't have an account yet? Sign up as