input只能输入数字

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>input只能输入数字</title>
</head>
<body>
  <input type="text"oninput="value=value.replace(/[^\d]/g,'')">
</body>
</html>

  

posted @ 2021-01-25 17:08  咖啡里的茶。  阅读(42)  评论(0编辑  收藏  举报