js只能输入数字和小数点的正则
2018-08-30 本文已影响520人
world_7735
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<form action="" novalidate>
<input type="text" autocomplete="off" id="price" autofocus="autofocus" onkeyup="value=value.replace(/[^\d^\.]+/g,'')">
</form>
</body>
</html>