HTML Editor
<!DOCTYPE html> <html lang="en-US"> <body> <p>'myFunction' is triggered when a key is being typed inside the input field.</p> <input type="text"> <script> var x = document.getElementsByTagName("input")[0]; function myFunction(){ alert("You pressed a key inside the input field"); } x.addEventListener("keypress", myFunction); </script> </body> </html>
OUTPUT
×

Save as Private