I wanted to stop the browser from going to next page after button submit inside an ajax condition.. i have a condition that if s variable passed from database is equals to 0, then it will not submit,else it will submit and go to the next page.
It prevents the event’s default behavior to happen. Like in you case submitting the form. Also, you can use it with a link to prevent redirection.
event.preventDefault(), avoid the page reloading, or the redirection to another page, If you put it inner an event listener function.
Members
Online