get key press onkepress code example
Example 1: js when key is pressed
document.addEventListener("keypress", function(event) {
// do stuff
});
Example 2: html onkeypress
<input type="text" onkeypress="myFunction()">
document.addEventListener("keypress", function(event) {
// do stuff
});
<input type="text" onkeypress="myFunction()">