why does my page reloads on form submission 1

why does my page reloads on form submission

//jquery method //
//preventDefault() prevents the submit button
//from performing its default task like page reload  
  $('#form').submit(function (e) {
      e.preventDefault();
  });

Here is what the above code is Doing:
1. We are using the jQuery library to select the form element with the id of form.
2. We are using the submit() method to attach a function to the form’s submit event.
3. We are using the preventDefault() method to prevent the form from submitting.

Similar Posts