1.js全局替换空格,制表符,换行符 oninput = "value=value.replace(/\s+/g,'')"
<input type="text" id="productTransactionCode" value="" oninput = "value=value.replace(/\s+/g,'')"
placeholder="若此项不填,无法关联主站出单" οnblur="checkExistence('code关联重复')"/>
2.控制input框只让输入数字 oninput = "value=value.replace(/[^\d]/g,'')"
<input type="text" id="payment" oninput = "value=value.replace(/[^\d]/g,'')" value="" placeholder="缴费年期必须是数字"/>
来源:CSDN
作者:qq_31594647
链接:https://blog.csdn.net/qq_31594647/article/details/104439839