i need a textbox which do not able to press the alphabetic key in Java Script and remove the entered which character.
Asked
Active
Viewed 85 times
-3
-
have you translated the text from some other language? – Apoorv Saxena Nov 08 '12 at 08:50
-
2no code, ambiguous question how do you expect an answer?? – Sibu Nov 08 '12 at 08:52
-
Do you mean a numeric-only text input? If so see http://stackoverflow.com/questions/995183/how-to-allow-only-numeric-0-9-in-html-inputbox-using-jquery – David-SkyMesh Nov 08 '12 at 08:58
1 Answers
0
simply add this attribute to your input:
onkeydown = "if(/[a-z]/i.test(String.fromCharCode((event||window.event).keyCode))){return false;}"

Mahyar
- 681
- 6
- 12