Javascript examples for DOM HTML Element:Input Text
Handle key event in input field text box
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){/*from www . jav a2 s .c om*/ var input = document.getElementById("name"); input.onkeyup = function(e){ if(e.keyCode == 32) console.log("Translate"); // Your translation code }; } </script> </head> <body> <input id="name" placeholder="Name"> </body> </html>