how to do onkeypress event in javascript code example Example: html onkeypress <input type="text" onkeypress="myFunction()">