$('input').on('keypress', function(e) {
if (e.which == 40 || e.which == 41)
e.preventDefault();
});
Disable keydown for open parenthesis
Question
Am trying to disable open and closed parenthesis for a textbox.
Am succesful in disabling keycode for few characters but not with the one uses SHIFT.
if(event.keyCode == 57 || event.keyCode == 48)
disables both 9 ,0 along with open and closed parenthesis
if (event.shiftKey) {
if(event.keyCode == 57 || event.keyCode == 48)
event.preventDefault();
}
how do i diable parenthesis alone and not numbers. what is the correct way.
i dont want to use any plugins
Thanks
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow