How to force keyboard with numbers in mobile website in Android

前端 未结 7 1569
南旧
南旧 2020-11-28 23:31

I have a mobile website and it has some HTML input elements in it, like this:



        
7条回答
  •  忘掉有多难
    2020-11-29 00:03

    Some browsers igoners sending leading zero to the server when the input type is "number". So I use a mixing of jquery and html to load a numeric keypad and also make sure that the value is sent as a text not as a number:

    $(document).ready(function(){
    $(".numberonly").focus(function(){$(this).attr("type","number")});
    $(".numberonly").blur(function(){$(this).attr("type","text")});
    })
    
    

提交回复
热议问题