Jquery not validating on submit

The reason to use Java Script is that it disables the submit button instantaneously. I have some field validation, can I disable submit button after all validations are OK?

A system of single-use client/server tokens can do this as well if you want to avoid relying on Java Script. This is a good solution, HOWEVER, it doesn't really stand well in 2013.

To test, click the Submit button twice in quick succession.

On the second click an alert window will be displayed, while the form continues submitting (from the first click) in the background.

This page addresses one of the less common, but still quite annoying problems, double-clickers.

A click on the submit button submits the form, but depending on your browser and connection speed the window of opportunity for a second click can vary from milliseconds to seconds.

Some modern browsers may also have taken measures to prevent duplicate submission.

A quick fix for this is to add an In this scenario the first click on the link will function normally taking the user to the target href.

At the same time it adds a new event listener to capture and disable future clicks on the same link.

The main difference here is that each function receives a variable The Java Script can now be included either inline on the page, or in a separate Java Script file referenced by the SCRIPT tag, and it will not interfere with any other scripts on the page because the event listener creates a closure and the contained functions are all defined as local variables.

Please or register to post comments
If spammers comment on your content, only you can see and manage such comments Delete all

Jquery not validating on submit introduction

Jquery not validating on submit