javascript prevent default for keyup
Solution 1:
No. keyup
fires after the default action.
keydown
and keypress
are where you can prevent the default.
If those aren't stopped, then the default happens and keyup
is fired.
Solution 2:
We can prevent the action by using following code snippet.
e.stopPropagation();
e.preventDefault();
e.returnValue = false;
e.cancelBubble = true;
return false;
keyup fires after keydown/keypress. we can prevent default action in anyone of those events.
Thanks,
Siva