I have searched through a lot of code on Google but all useless when it comes to blocking the typing of % sign when pressing Shift + 5 key-combination in any textfield.
Is there no code that can actually do that in the Chrome and IE browsers, almost all latest versions effectively ?
I wanna do this for Zipcode validation wherein the requirement is that, User shouldn't be allowed to type anything but numbers and be able to edit and remove numbers only.
I tried below code and many keyCodes to block this but it still types % sign when I type Shift + 5 in the relevant textfield:
if ( key < 48 || key > 57 || event.charCode == 37 || event.which == 37 || event.which == 16 || event.which == 163) {
event.preventDefault();
return false;
}
Can anyone help ?