-6
rated 0 times
[
0]
[
6]
/ answers: 1 / hits: 27490
/ 13 Years ago, mon, december 26, 2011, 12:00:00
i wanted to Allow only Numbers in text box using jquery/javascript with out extra plugins
I have coded like :
if ( event.keyCode == 46 || event.keyCode == 8 || (event.keyCode >=48 && event.keyCode <=57)) {
// let it happen, don't do anything
}
else {
// Ensure that it is a number and stop the keypress
event.preventDefault();
}
but it allows special characters like ! (Shift+1), @ (shift +2) etc.
can any body tell me the complete solution for this .. thanks in advance
More From » jquery