Back to Top

Run-Time Validation using jQuery

Run-Time Validation using jquery

Here I come with the new quick article. In this article, I am going to explain to validate field run time using jQuery.

jQuery Validator is very useful tool to validate fields immediately using jQuery.
For Example, You want to check email exists in the database. So, you need to write validation rules which runtime check an email address.

Let’s understand below code:

$(document).ready(function() {

   $("$#id").validate({
	rules: {
		email: {
			required: true,
			email: true,
                remote: {
                     url : <post_data_url>,
                     type: "post",
                     data: {
                        email: function() {
                        return $( "#email" ).val();
                       }
                     }
              }
          }
       }
  });
});

Here In above code, I have written .rules() inside the .validate().

The remote method will work same like Ajax call. You can pass request data and URL same like Ajax request.

Further Read:

Jquery Tabs in WordPress without plugin
jQuery Shake Effect Explained
JQuery Animation Explained

That’s it.I’m hoping that you’ve found this article helpful. Don’t hesitate to use this code and post your comments if you need help. As always, thanks for reading. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

How to enable Debug Console in X-cart?

Posted on 5 years ago

Bhumi

Session_start( ) :: At the top of the page

Posted on 6 years ago

Bhumi

What is Wpautop() function in WordPress

Posted on 4 years ago

Bhumi

The Reader’s Poll – June 2015

Posted on 3 years ago

Bhumi

The Reader’s Poll – August 2014

Posted on 4 years ago

Bhumi

The Reader’s Poll – June 2014

Posted on 4 years ago

Bhumi

The Readers’ Poll – May 2014

Posted on 5 years ago

Bhumi

The Readers’ Poll – August 2013

Posted on 5 years ago

Bhumi