js check can only be a positive integer

   var merchantNum = $("#merchantNum").val();
        if (merchantNum == null || merchantNum == "") {
            alert("数量不能为空");
            return false;
        }
        else if (!(/(^[1-9]\d*$)/.test(merchantNum))) {
            alert("数量不是正整数!!!");
            return false;
        }

Published 125 original articles · won praise 36 · views 20000 +

Guess you like

Origin blog.csdn.net/qq_30757161/article/details/97519642