input框实现限制输入1-100

<input id="pip_${channel.id}_1" type="text" class="form-control inp_type1 w100"  name="name" maxlength="12" oninput="if(!/^[0-9]+$/.test(value)) value = value.replace(/[^\d]/g,'');if(value>100)value=100;if(value<0)value=null">

核心代码:

οninput="if(!/^[0-9]+$/.test(value)) value = value.replace(/[^\d]/g,'');if(value>100)value=100;if(value<0)value=null"

猜你喜欢

转载自blog.csdn.net/huan1213858/article/details/131897839