![]() |
VOOZH | about |
The DOM onkeypress event in HTML occurs when a key is pressed by the user. Order of events related to the onkeypress event:
Supported HTML tags: All HTML elements, EXCEPT:
Syntax:
<element onkeypress="myScript">
object.onkeypress = function(){myScript};object.addEventListener("keypress", myScript);
Example: onkeypress Event using the addEventListener() method
Output:
Supported Browsers: The browsers supported by HTML DOM onkeypress Event are listed below: