I would use the j Query validation plugin for a few reasons. You need to display the error, handle erasing it when it is valid, displaying how many errors total perhaps?
There are lots of things it can handle for you, no need to re-invent the wheel.
The following form contains some typical validators needed in a registration form.
This j Query plugin has support for a lot more validation functions, you find them all in the menu to the right.
It's like following the instructions from the factory to install the wheel on a modern vehicle (jack the car up, place the wheel - put on the lug nuts) instead of trying to figure out how to get a wagon wheel on your car. To do the form validation it's literally an include, some annotations, and a single method call. So if you type an email with the wrong TLD or domain that is very similar to a common email domain (hotmail.com, gmail.com, etc), it can detect this and suggest a correction.is a markup language, and is by far the most commonly used language on the Web. They say what parts are headings, what parts are paragraphs, what parts are bullet lists, etc.The W3C HTML 4.0.1 specification is available if you need to check on what elements are available and what attributes they support.This tutorial is based on on the W3C recommendation, where the idea is to use CSS wherever possible, but to still include semantic HTML to support older browsers.I have also written a CSS tutorial to demonstrate its use.