Javascript examples for DOM HTML Element:Input Submit
call function after filling form and pressing enter
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){// w w w . j a v a2 s. com document.getElementById('myform').onsubmit = function(e) { procesText(); e && e.preventDefault && e.preventDefault(); return false; } function procesText(){ console.log('do some stuff'); } } </script> </head> <body> <form id="myform"> First Name: <input type="text" id="myText" maxlength="30"> </form> </body> </html>