Skip to content
Advertisement

How do I make my page stop refreshing after clicking submit button?

Trying to make popup window with form in it. When clicking submit, page is refreshing. How can I prevent it? My e.preventDefault is not working

JavaScript

Advertisement

Answer

I assume you’ve added the submit event listener to the button and not the form. Check this out and it should work.

JavaScript
JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement