行内input校验-HTML

<input> 标签规定了用户可以在其中输入数据的输入字段。<input> 元素在 <form> 元素中使用,用来声明允许用户输入数据的 input 控件。输入字段可通过多种方式改变,取决于 type 属性。记录了一些手动验证规则。

<!--禁止输入空格-->
<input type="text" onkeyup="this.value=this.value.replace(/\s+/g,'')">


<!--输入数字-->
<input type="text" name="pre" value="" onkeyup="value=value.replace(/[^(\d)]/g,'')" placeholder="输入数字">


<!--输入字母、数字、小数点-->
<input type="text" class="seaInp wid160" name="patentNum" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')" placeholder="字母、数字、小数点" value="">
                            
Licensed under 京ICP备17003353号-3