Tag archive for: $.change

How to validate input fields as the user is filling up a form with jQuery

In order to get sensible data from users via an online form, we have to validate data that we receive from them . As much as possible, we will want the data validation process to minimize frustration to our users.

We could have perform the data validation on the input fields at the point when the form is submitted. However, a better way will be to perform data validation on the input fields as the user is filling up the form. The validation process can follow such a sequence:

  1. User clicks on the input field.
  2. User fills up the input field with data.
  3. User clicks away from the input field.
  4. Data validation occurs on the input field. If there are any errors, display the error message near to the input field. Else everything proceeds as usual.