webSnow
复制代码
<input type="text"  maxlength="5" />   //可以

<input type="number"  maxlength="5" />  //没有效果

<input type="number" oninput="if(value.length>5) value=value.slice(0,5)" /> //js控制,可以

<input type="tel"  maxlength="5" />  //tel类型,可以
复制代码

此外,tel类型的input在ios上会调出全数字键盘,而number类型的input则会调出带有标点符号的键盘。

分类:

技术点:

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2021-08-29
  • 2021-08-01
  • 2022-12-23
  • 2021-06-17
猜你喜欢
  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案