//限制输入内容必须为数字 不能为0 开头
$("#ipt").on("input",function(){
    var obj = $(this);
        var money = obj.val();
        if(/^0+/.test(money)){
        money = money.replace(/^0+/, '');
        $(obj).val(money);
    }
    if( !/^(\d+)$/.test(money) ){
        money = money.replace(/[^0-9]/g, '');
        $(obj).val(money);
    } 

})

 

相关文章:

  • 2022-02-28
  • 2022-12-23
  • 2021-11-17
  • 2022-12-23
  • 2021-11-28
  • 2021-07-12
  • 2021-06-01
  • 2022-12-23
猜你喜欢
  • 2022-02-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2022-12-23
相关资源
相似解决方案