【HTML&CSS】【2】去掉input标签type=number时出现的箭头,及禁止输入e和...


正文:

1,去掉箭头

/*添加css样式*/
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
}
 
input[type="number"] {
    -moz-appearance: textfield;
}

2,及禁止输入e和...(只能输入纯数字)

<input type="number" autocomplete="off" onkeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))" style="ime-mode:Disabled">

参考博客:

input中 type=number 的文本框(数字框) 去掉箭头 且不能输入e和标点符号 - nnn_net的博客 - CSDN博客
https://blog.csdn.net/nnn_net/article/details/70778242

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM