input的type属性设为number后可以输入e


原因:e在数学上代表2.71828,所以它也还是一个数字

解决方法:

<input type='number' onkeypress='return( /[\d]/.test(String.fromCharCode(event.keyCode)))' />

 

2.input数字number类型的时候maxlength无效

解决方法:超出截取

<input type="number" oninput="if(value.length>11)value=value.slice(0,11)" />  

 


免责声明!

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



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