小数点校验

//校验金额--整数最多5位,小数最多2位
$("#unitCapital").blur(function(){
    var reg = /((^[1-9]\d{0,4})|^0)(\.\d{1,2}){0,1}$/;
    if(!reg.test(this.value)){
        alert("格式不对!整数最多5位,小数最多2位");
        $(this).val("");
    }
    
});

 

posted @ 2022-07-31 12:53  一隅桥畔  阅读(109)  评论(0)    收藏  举报