Javascript examples for DOM:Key Event
Calling an AJAX function using the Enter Key
<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 ww . ja v a 2 s . c o m*/ }); </script> </body> </html>