Navigation

Jquery Validation: Numeric Validation using Jquery

Numeric Validation using Jquery, Numeric Validation in Jquery, Jquery Validation, Validate Data in Jquery

Introduction

Today, I am going to explain about numeric validation using Jquery. Jquery plays a great role to validate data at client side without refreshing whole the page. To make your application more user friendly, interactive and soothing then Jquery plays a vital role to fulfill your dreams.
Data Input Text Box

Number :  

While typing in Input box other Numeric showing error message

Numeric Jquery Validation


Jquery Code Snippet


$(document).ready(function () {
  //on keypressed in textbox
  $("#age").keypress(function (e) {
     //if not numeric, then it don't let you type
     if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
        //display error message
        $("#errmsg").html("Digits Only").show().fadeOut("slow");
               return false;
    }
   });
});

Numeric Jquery CSS Code

#errmsg
{
color: red;
}

Final View of Code Snippet


Conclusion

You did see above how we can validate Numeric Validation using Jquery, it plays great role to make our application robust and interactive over the internet. While our application playing with Browser then Jquery helps us to validate data at browser end.

Suggested Reading


Share

Anjan Kant

Outstanding journey in Microsoft Technologies (ASP.Net, C#, SQL Programming, WPF, Silverlight, WCF etc.), client side technologies AngularJS, KnockoutJS, Javascript, Ajax Calls, Json and Hybrid apps etc. I love to devote free time in writing, blogging, social networking and adventurous life

Post A Comment:

0 comments: