Well, let's create a Java Script file named "validator.js" and place the following code inside it, then save it at the same location where you've saved the previous HTML file.
Go through each line of the following example code to understand how Java Script validation works: .
Well, let's create an HTML file named "application-form.html" and place the following code in it, then save it somewhere on your system.
In this example, we are going to validate the name and password.
But it is quite possible that some user might not enter the data what you've expected.
So to save bandwidth and avoid unnecessary strain on your server resources you can validate the form data on client-side (i.e.
It is one of the most effective techniques for validating the user inputs.
Furthermore, the above script will also display the data entered by the user in an alert dialog box for preview purpose before submitting the form to the web server.