HTML onKeyDown-Event calling function and button-click - HTML CSS CSS Form

HTML CSS examples for CSS Form:input button style

Description

HTML onKeyDown-Event calling function and button-click

Demo Code

ResultView the demo in separate window

<html>
 <head></head> 
 <body> 
  <form>
    Search <!--  w  w w  . j a  v  a2 s  .  c o m-->
   <br> 
   <input type="text" id="searchField" onKeyDown="if(event.keyCode==13){console.log('Hello World from Input'); return false;}"> 
   <br> 
   <button type="button" id="myButton" onclick="console.log('Hello World from Button')">Search</button> 
  </form>  
 </body>
</html>

Related Tutorials