Example
Execute a section of JavaScript when the user presses a key:
<input type="text" onkeydown="displayResult()">
Browser support
IE
Firefox
Chrome
Safari
Opera
All major browsers support onkeydown Attributes.
Definition and Usage
The onkeydown property is triggered when the user presses a key (on the keyboard).
Tips: Event order relative to onkeydown event :
onkeydown onkeypress onkeyup
Comments :onkeydown attribute does not apply to the following elements:
, , ,