Handle key event in input field text box - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Handle key event in input field text box

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials