event listener for key press js code example Example: html onkeypress <input type="text" onkeypress="myFunction()">