Textbox numeric validation using javascript or mobile number validation in Javascript

Textbox numeric validation using javascript

In the previous example, we have seen Character, Numeric, Character count validation for textbox using javascript in ASP.NET in javascript. Now are doing mobile number or numeric textbox validation in with fixed number count.

If you have any questions we ask in comment. I will help you.

Source Code:

<html>
<head>
    <title></title>
    <script type="text/javascript">
        function ValidateForm() {
            var txtName = document.getElementById("txtName").value;
            var regularExpression = /^[0-9]{10,}/; 

            if (!txtName.match(regularExpression)) {
                alert("Please enter 10 digit mobile number");            
            }
        }   </script>
</head>
<body>
Mobile Number: <input type="text" id="txtName" /><br />
<br />
<input type='button' value="validate" onclick="ValidateForm();" />

</body>
</html>


Before doing this most of the forms required, required field validation for textbox using javascript.

Please see JQuery Interview questions also for more information.

For all validations, please visit my articals on Form Validations.

More ASP.NET interview questions

Sharing is caring... possible share this post to friends.
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar