如何使文本框只允许三位小数点后的数字?
我想让文本框只允许三位数字和三位小数。例如 999.999。类似地,它不允许任何字符,如 a、b、/ 等。我该如何使用 Jquery ?
I want to make the textbox allow only three digits and three decimals.For example 999.999.similarly it doesnt allow any characters like a,b,/,etc.How can I do with the Jquery?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你看过 jQuery.validate 插件吗?
编辑:诚然,我没有测试正则表达式,只是想演示它是如何工作的。
根据 nickf 的建议更新了正则表达式,谢谢。
Have you looked at the jQuery.validate plugin?
EDIT: admittedly I didn't test the regex and merely wanted to demonstrate how it works.
Updated regex as per nickf's suggestion, thanks.
看一下 jQuery 数字插件。
Take a look at jQuery numeric plugin.
您还可以查看这个 屏蔽输入 插件
You could also look at this masked input plugin