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

断了今生、忘了曾经 提交于 2019-12-01 19:31:10

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/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!