Pages

Ads 468x60px

For New Update Use this Link http://dotnethubs.blogspot.in/ Offer for you

.

Showing posts with label jquery textbox validation in asp.net. Show all posts
Showing posts with label jquery textbox validation in asp.net. Show all posts

Monday 29 April 2013

jQuery Restrict to Allow Only Numbers in Textbox in Asp.net

create simple drop down menu using jquery
Introduction : -
Here I will explain how to allow only numbers or numeric characters in textbox using JQuery in asp.net.with error message 

Description :- 
In previous posts I explained  I have Explain create simple drop down menu using jquery ,Simple Menu using Jquery step by step  Now   I will expplain how to allow only numbers or numeric characters in textbox using JQuery in asp.net.

To restrict user to enter only number in textbox we write the following code as shown below

Jquery code as shown below

 Code is Here




<head runat="server">
    <title>jquery text box valiation only enter the number</title>
    <script type="text/javascript" src="Scripts/jquery-1.4.1.js"></script>

    <script type="text/javascript">
        $(document).ready(function () {
    //called when key is pressed in textbox
            $("#quantity").keypress(function (e) {
                //if the letter is not digit then display error and don't type anything
                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;
                }
            });
        });
 
    </script>
    <style type="text/css">
    #errmsg
    {
        color:Red;
    </style>

  
</head>

asp.net  form code here
 Code is Here




<body>
    <form id="form1" runat="server">
    <div>
   Number : <input type="text" name="quantity" id="quantity" />&nbsp;<span id="errmsg"></span><br /><br/>
 
    </div>
    </form>
</body>

After Write Code The Page Is Shown Below



Download sample code attached






Simple Menu using Jquery Beginners Tutorial , create simple drop down menu using jquery
 

..




New Updates

Related Posts Plugin for WordPress, Blogger...

Related Result