Question · JavaScript and TypeScript course · Module 8: Events and the DOM

Quiz: Form Submit Event

What should be done to prevent the default page reload when submitting a form?

Answer options

  • Remove the method attribute from the form
  • Set the action attribute to '#' in the form tag
  • Use the form.stop() method
  • Call event.preventDefault() in the submit event handler

You can check the correct answer by solving this task in the CodeWorlds game.