Posted inTechnology / JavaScript / jQuery / Programming

jQuery Form Validator Script

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.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype