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
I solved by using the below code snippet. thanks for the inputs and help