🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: DOM and Events: all 10 questions

Quiz: DOM and Events · Question 2 of 10

Why call event.preventDefault() in a form submit handler?

Why call event.preventDefault() in a form submit handler?

  1. A.To clear the form
  2. B.To stop the browser from reloading the page / sending the form normally
  3. C.To stop other listeners
  4. D.To validate the form
Answer & explanation

Correct answer: To stop the browser from reloading the page / sending the form normally

Without it, the page navigates away before your JavaScript finishes.

Can you get the rest right without peeking?

Take the timed Quiz: DOM and Events quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →