<input type="text" id="memberId" lay-verify="title" autocomplete="off" placeholder="请输入会员ID" class="layui-input" onkeyup="value=value.replace(/[^\d]/g, '').replace(/^0{1,}/g,'')" />

第一个replace使用的正则,把所有的非数字字符过滤掉。

第二个replace使用的正则,在第一个的基础上,不允许0开头。

相关文章:

  • 2021-11-24
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-15
  • 2022-12-23
  • 2022-12-23
  • 2021-12-28
  • 2021-07-22
  • 2021-05-25
相关资源
相似解决方案