Jquery how to check if a input has a number higher then 99

后端 未结 8 1314
离开以前
离开以前 2021-01-06 05:08

Was wanting to know how to check using jquery if a input contains a number higher then 99

8条回答
  •  北恋
    北恋 (楼主)
    2021-01-06 05:24

    Use this:

    html:

    
    

    jquery:

    var nMyInput = $("#myInput").val();
    if (typeof nMyInput != "undefined"){
        if(!isNaN(nMyInput)){
            if (parseInt(nMyInput) > 99) {
                /* do your stuff */
            }
        }
    }
    

提交回复
热议问题