checking if number entered is a digit in jquery

前端 未结 10 1737
遥遥无期
遥遥无期 2020-12-01 01:19

I have a simple textbox in which users enter number.
Does jQuery have a isDigit function that will allow me to show an alert box if users ente

10条回答
  •  情歌与酒
    2020-12-01 02:00

    $(document).ready(function () {
    
    
    
        $("#cust_zip").keypress(function (e) {
            //var z = document.createUserForm.cust_mobile1.value;
            //alert(z);
            if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
    
                $("#errmsgzip").html("Digits Only.").show().fadeOut(3000);
                return false;
            }
        });
    });
    

提交回复
热议问题