Limit key input for HTML input tag - Javascript jQuery

Javascript examples for jQuery:Form Event

Description

Limit key input for HTML input tag

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from  w  w w.j  a va2s.c  o  m*/
$("#input1").keydown(function(e){
    if (e.keyCode != 65)
        return false;
});
    });

      </script> 
   </head> 
   <body> 
      <input type="text" id="input1"> 
      <input type="text" id="input2">  
   </body>
</html>

Related Tutorials