Returns a string representation of the key pressed. The following listens to and prevents backspaces being pressed in inputs:
$("input").keypress(function(ev){ if(ev.key() == '\b') { ev.preventDefault(); } });
The following describes the key values returned by jQuery.Event.key.
Use jQuery.event.key to set alternate key mappings for other locales.
event.key() -> String
{String}
The string representation of of the key pressed.
Returns a string representation of the key pressed. The following listens to and prevents backspaces being pressed in inputs:
Keys
The following describes the key values returned by jQuery.Event.key.
Alternate keys
Use jQuery.event.key to set alternate key mappings for other locales.