115
rated 0 times
[
121]
[
6]
/ answers: 1 / hits: 113346
/ 11 Years ago, wed, august 14, 2013, 12:00:00
I need to have a textbox, where, whenever typed inside should ONLY allow numbers [0-9]. I've used type=number
which definitely holds the client side validation but also allows to type other alphabets. I can do it by tracking each keydown and matching with regex but I was wondering if there is any way I can restrict to type using only html tags and NOT defining any functions in JavaScript to compare in each keydown?
Code not sufficient to do so is:
<input type=number id=txt_number maxlength=70 name=txt_name placeholder=Number>
Any help is appreciated.
More From » html