O'Reilly logo

jQuery and JavaScript Phrasebook by Brad Dayley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Controlling Form Submission

$("form").submit(function(e){     alert("Sorry. Not yet Implemented.");     e.preventDefault();   });

Another important aspect of dynamic form flow control is intercepting the submit and reset event and performing actions based on various conditions. For example, you might want to validate form values before you allow the form to be submitted.

The way that you control the form submission functions to attach a submit event handler to the form. Inside the event handler, you have access to information about the event as well as the form data to be submitted. You can perform whatever tasks you need and then either allow the form to be submitted or reset or prevent the default browser ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required