jQuery event.which property
Examples
Returns which keyboard key is pressed:
$("input").keydown(function(event){
$("div").html("Key: " + event.which);
});
$("div").html("Key: " + event.which);
});
try it"
Definition and Usage
event.which property returns the specified event which keyboard key or mouse button is pressed.
grammar
event.which
参数 | 描述 |
---|---|
event | 必需。 event 参数来自事件绑定函数。 |
More examples
Returns which mouse button is pressed
Which mouse button is pressed on the display specified event.