标签:inpu style pat java javascrip put text code type
1 <input type="text" placeholder="请输入您的用户名..."> 2 <script type="text/javascript"> 3 $("input[name=‘username‘]").bind(‘input‘,function(){ 4 var pattern = new RegExp("[^a-zA-z1-9]"); 5 var rs = ‘‘; 6 var str = $(this).val(); 7 8 for (var i=0;i< str.length;++i){ 9 rs = rs + str.substr(i, 1).replace(pattern,‘‘); 10 } 11 12 $(this).val(rs); 13 }); 14 </script>
标签:inpu style pat java javascrip put text code type
原文地址:http://www.cnblogs.com/jingjingdidunhe/p/7335306.html