JS限制输入框只能输入数字

限制输入框只能输入数字(使用正则)

let reg=/[/D]/g;
input.oninput=function(){
		this.value=this.value.replace(reg,'');
}
/D: 匹配数字
/d: 匹配除数字以外的任何

猜你喜欢

转载自blog.csdn.net/qq_41709082/article/details/84454578