input 阻止number类型的文本框,输入E或者e

因为number只能输入数字,但是e和E在数学中都为科学计数法,所以可以输入,但可用正则过滤掉。

<input type="number" onkeypress="return /\d/.test(String.fromCharCode(event.keycode))">
hxy

hxy

秦 夏

留下你的评论

快留下你的小秘密吧