1.js全局替换空格,制表符,换行符 oninput = "value=value.replace(/s+/g,'')"
<input type="text" id="productTransactionCode" value="" oninput = "value=value.replace(/s+/g,'')"
placeholder="若此项不填,无法关联主站出单" onblur="checkExistence('code关联重复')"/>
2.控制input框只让输入数字 oninput = "value=value.replace(/[^d]/g,'')"
<input type="text" id="payment" oninput = "value=value.replace(/[^d]/g,'')" value="" placeholder="缴费年期必须是数字"/>
2.控制input框只能输入数字和小数点 oninput = "value=value.replace(/[^d^.]+/g,'')"
<input type="text" id="yjsx_rateYear1" oninput = "value=value.replace(/[^d^.]+/g,'')" placeholder="请输入">
最后
以上就是暴躁蜻蜓最近收集整理的关于公用js方法的全部内容,更多相关公用js方法内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复