Simple example program of validating form using onblur function

It sets the focus to the input field until the user supplies a valid value.

The later Java Script function created is called on the onsubmit event of the form. If Male or Female is selected, it generates an alert saying that the form is successfully submitted and it reloads the form.

We have created Java Script functions (one for each input field whose value is to be validated) which check whether a value submitted by user passes the validation.

It sets and keeps the focus on the input field until the user supplies a valid value.

First, we need to include j Query v1.x as the validation plugin is currently only compatible with j Query versions lower than 2.0.

There are the following download options: @import "compass"; @import url("

function allnumeric() // This function will validate Email.

function Validate Email() You can view this Field Level Sample Java Script Registration From Validation Example in a separate browser window and check how the validation is working.

All those functions are called from another function.

family=Open Sans"); /* Color settings */ $form Bg: #2c3e50; $form Color: #fff; $input Bg: #fff; $input Color: #000; $button Bg: #e67e22; $button Color: #fff; $error Msg Color: #ff0000; /* Styles */ * body .container form That’s it, you’re done!

Now you have an idea how to set up form validation with j Query.

function firstfocus() // This function will validate User id.

function userid_validation(mx,my) // This function will validate Password.

Leave a Reply