2

my requirement is to made html textfield for mobilenumber to accept only numbers

For example If user enters '+' symbol or alphabets then it should not allow him to enter

Gouse
  • 57
  • 1
  • 8

1 Answers1

5

You can use Html 5 in this case.

<input type="number" />

Otherwise, if you want to use Javascript to reach this you can take a look to this question.

Community
  • 1
  • 1
Chuck Norris
  • 15,207
  • 15
  • 92
  • 123
  • Thanks for the response I am using Html 4.01 input type ="number" not working – Gouse Apr 27 '12 at 07:42
  • In that case you must use Javascript/Jquery to achieve this. Check the question that I've posted. – Chuck Norris Apr 27 '12 at 07:46
  • Or you can use simple TexoTela plugin for it... Here is it http://www.texotela.co.uk/code/jquery/numeric/ Write, if you have any questions. – Chuck Norris Apr 27 '12 at 07:47
  • I am using Extjs for validation if mobile number is empty i can show alert to user to enter the values as it is mandatory column like this – Gouse Apr 27 '12 at 07:48
  • document.getElementById("snumber").value=snumber; – Gouse Apr 27 '12 at 07:49
  • 1
    HAI CHUCK THIS CODE WORKS http://www.htmlcodetutorial.com/forms/index_famsupp_158.html – Gouse Apr 27 '12 at 10:24