Easy Javascript Validation using JQuery
Now, there might be other tools out there, but this is how I do mine. I like to write stuff from scratch but I actually feel like this little script would make life easier for a lot of people. You're free to use this as long as you leave the copyright in there.
First download jQuery and this script: jquery.validator.js (Right click>Save As)
Next, add these lines.
<script src="jquery.js" type="text/javascript"></script>
<script src="jquery.validator.js" type="text/javascript"></script>
When you create your forms create them like this.
The form must have an id, and it must have the class "validate".
Add the class 'req' for any fields that are required.
Coming soon: email, int verification, age, etc.
<form id="contactform" action="whatever_action_you_want.php" class="validate"> <input type="text" name="firstname" class="req"/><span class="val">*</span> <input type="text" name="lastname" class="req"/><span class="val">*<span> <select name="country req"> <option value="">Please select</option> <option value="CA">Canada</option> </select> </form>
In your css add these
span.val{visibility: hidden; color: red; font-weight:bold;}
Thats it.
If you guys post comments and subscribe, I can let you know when i further develop this. It will include number verification, email verification, postal code verification. It's very simple and lightweight and will shave time off any project. File (Right click>Save As): jquery.validator