Today, We want to share with you jQuery Form Validator Script.In this post we will show you simple jquery form validation example, hear for jquery form validation without plugin we will give you demo and example for implement.In this post, we will learn about registration form validation using jquery validator with an example.
jQuery Form Validator Script
There are the Following The simple About jquery form validation tutorial Full Information With Example and source code.
As I will cover this Post with live Working example to develop jquery form validation demo with source code, so the some major files and Directory structures for this example is following below.
Step 1: Include jQuery library
At first we need to include jQuery Latest library file.
Step 2: JavaScript/jQuery Source Code:
This file All the Data contains the following JavaScript/jQuery Source codes.
$(document).ready(function() { $("#memberFrm").validate({ rules: { name: "required", email: { required: true, email: true }, phone: { required: true, number: true }, url: { required: false, url: true }, username: { required: true, minlength: 6 }, password: { required: true, minlength: 6 }, confirm_password: { required: true, minlength: 6, equalTo: "#password" }, agree: "required" }, messages: { name: "Please enter your name", email: "Please enter a valid email address", phone: { required: "Please enter your phone number", number: "Please enter only numeric value" }, url: { url: "Please enter valid url" }, username: { required: "Please enter a username", minlength: "Your username must consist of at least 6 characters" }, password: { required: "Please provide a password", minlength: "Your password must be at least 6 characters long" }, confirm_password: { required: "Please provide a password", minlength: "Your password must be at least 6 characters long", equalTo: "Please enter the same password as above" }, agree: "Please accept our policy" } }); });
Step 3: HTML Source Code:
This file contains the following HTML Markup Source codes.
Step 4: CSS Source Code
Following CSS Source codes are used for JQuery Form Validation using jQuery Validation Plugin Tutorial.
.memberFrm{width: 400px;} .memberFrm p { width: 100%; } .memberFrm label { width: 120px; color: #333; float: left; } input.error { border: 1px dotted red; } label.error{ width: 100%; color: red; font-style: italic; margin-left: 120px; margin-bottom: 5px; } .memberFrm input.submit { margin-left: 120px; }
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about form validation using jquery.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.