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.

  Create Dynamic Web Pages using PHP-MYSQL

<script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.0/jquery.validate.js'></script>

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.

  Paytm Payment Gateway Integration in PHP step By step

<form class="memberFrm" id="memberFrm" method="post" action="">
<p>
<label for="name">Name</label>
<input id="name" name="name" type="text">
</p>
<p>
<label for="email">E-Mail</label>
<input id="email" type="email" name="email">
</p>
<p>
<label for="phone">Phone</label>
<input id="phone" type="phone" name="phone">
</p>
<p>
<label for="url">URL</label>
<input id="url" type="url" name="url">
</p>
<p>
<label for="username">Username</label>
<input id="username" name="username" type="text">
</p>
<p>
<label for="password">Password</label>
<input id="password" name="password" type="password">
</p>
<p>
<label for="confirm_password">Confirm password</label>
<input id="confirm_password" name="confirm_password" type="password">
</p>
<p>
<label for="agree">Please agree to our policy</label>
<input type="checkbox" class="checkbox" id="agree" name="agree">
</p>
<p>
<input class="submit" type="submit" value="Submit">
</p>
</form>

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 :

  Vuejs color picker Plugins With Examples

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.