How did event.preventDefault() help in handling form submission? event.preventDefault() stopped the form from submitting the traditional way (which would reload the page and possibly clear all data).