input type="number" 禁止输入E

xiaoxiao2021-02-28  50

$(‘input[type=number]’).keypress(function(e) {   if (!String.fromCharCode(e.keyCode).match(/[0-9.]/)) {     return false;   } });

fromCharCode()是String的一个方法,可接受一个指定的Unicode值,返回一个字符串

使用方法:String.formCharCode()

转自:https://www.cnblogs.com/senyu/p/7125565.html

转载请注明原文地址: https://www.6miu.com/read-2619101.html

最新回复(0)