Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery event.which property

jQuery event.which property

jQuery event methods jQuery event methods

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 jQuery event methods