Add key up action handler to input box - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form Event

Description

Add key up action handler to input 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 w w  w. ja  v a 2  s .com
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