Here I will explain how to restrict user to allow only numbers in textbox and how to restrict user to enter only 10 digits mobile number using JavaScript and I will explain how to allow only numbers and alphabets in textbox using JavaScript.

Description

I have a one textbox now I need to allow user to enter only numbers not more than that if user try to enter characters or alphabets I don’t want to allow those characters in textbox for that I have written one JavaScript function to allow only numbers and allow only 10 numbers.

hi jo if you do this example in your application it will work perfectly. To arrange live demo in website i did this sample using html controls because of that small problem is there with backspace or delete buttons.

Dear Suresh it is working fine in normal webpage which contain the javascript . if i keep the javascript as seperate file . how can i implement the code. because my page is inherited from master page so i can't use javascript with in the page

hey Suresh... The concept of our site is out standing ..it gives us a perfect idea ,how to impliment code ..really a great site.. for ASP.NET developers...is their any article related to SQL INJECTION if yes plz post or send me the link... ..thank you

Hi Suresh Sir .....Your Site is very helpful for developers . but here where is updated new code . when we enter numbers it accept 10 digits,ok it's fine and good ,but when enterd all 10 numbers in textbox it can't perform back button and not editing mode .how i solve this problem