Screen input character for input field - Javascript jQuery

Javascript examples for jQuery:Form Input

Description

Screen input character for input field

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-1.7.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from  www  .  jav  a2 s. co m*/
$('#input').bind('keyup', function(){
    var sanitized = $(this).val().replace(/[^0-9a-f]/g,'');
    $(this).val('#'+sanitized);
});
    });

      </script> 
 </head> 
 <body> 
  <input type="text" id="input" placeholder="#">  
 </body>
</html>

Related Tutorials