时间:2021-07-01 10:21:17 帮助过:17人阅读
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>input type=number 禁止输入小数点</title> <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> <script src="jquery.min.js" type="text/javascript"></script></head><body> <input type="text" name="number" id='number'/><script>$(document).ready(function(){ var ipt = $('#number'); ipt.on('keyup',function(){ if(! /^\d+$/.test(this.value)){ this.value=''; } }) });</script></body></html>
以上就是input type=number禁止输入小数如何实现的详细内容,更多请关注Gxl网其它相关文章!