In MS Edge, placeholder text doesn't disappear after entering text in input type=“number”

前端 未结 1 1045
醉梦人生
醉梦人生 2021-01-19 07:46

To see the issue try this Snippet:

相关标签:
1条回答
  • 2021-01-19 08:03

    You could always manually filter out letters by watching the keypress event. Here's some JQuery code that will only allow you to type "0123456789" into a number textbox:

    $("input[type='number']").keypress(function(event){
        // If this key is not a number...
        if (event.which < 48 || event.which > 57)
      {
        event.preventDefault();
        return false;
      }
    });
    

    Here's your JSFiddle forked to include this code: https://jsfiddle.net/o263wmnh/

    0 讨论(0)
提交回复
热议问题