How to make input type number un-editable but still functioning?

前端 未结 3 1808
北荒
北荒 2020-12-22 10:58

I tried this one but not working. is there any way

3条回答
  •  既然无缘
    2020-12-22 11:32

    Try this one. It works for me.

    $("#testid").keypress(function (e) {
        e.preventDefault();
    }).keydown(function(e){
        if ( e.keyCode === 8 || e.keyCode === 46 ) {
            return false;
        }
    });
    

提交回复
热议问题