Javascript examples for DOM HTML Element:Form Event
Handler input box key event and check key code and key char
<html lang="en"> <head> <title> Luke Boyle</title> </head> <body translate="no"> <input id="myInfo"> <script> document.getElementById('myInfo').addEventListener('keypress', function(event) { // you could also do keyCode === 13 if (event.key === 'Enter') { console.log('do ajax request here'); }/*from w w w . jav a 2 s. co m*/ }); </script> </body> </html>