How does one prevent a form from submitting when using JavaScript?
Show answerHide answer
Correct answer: (A) event.preventDefault()
Explanation
Calling event.preventDefault() in the submit handler cancels the browser's default action, the form submission. stopPropagation() only stops the event from bubbling.