jQuery event.which property
Example
Return which keyboard key was pressed:
$("input").keydown(function(event){
$("div").html("Key: " + event.which);
});
Try it »
Definition and Usage
The event.which property returns which keyboard key or mouse button was pressed for the specified event.
Syntax
event
.which
| Parameters | Description |
|---|---|
| event | Required.event The parameters come from the event binding function. |
More examples
Returning which mouse button was pressed
Display which mouse button was pressed for the specified event.
jQuery event methods