Javascript examples for jQuery:Form Input
Screen input character for input field
<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>