简体   繁体   English

文本输入中的最小最大数字-Jquery / javascript

[英]min max number in text input - Jquery/javascript

I would like to set a minimum and maximum allowed number to be entered in text input I know I can do this with range input but will it still have the max and min when used in non compatible browsers? 我想设置在文本输入中输入的最小和最大允许数量,我知道我可以使用范围输入来做到这一点,但是在不兼容的浏览器中使用时,它仍将具有最大值和最小值吗?

if not could you please point me in the right direction, thanks for reading. 如果不能,请指出正确的方向,谢谢阅读。

Use jquery validator plugin . 使用jquery验证程序插件 It has a nice set of features, and min max validation too. 它具有一组不错的功能,并且还具有最小最大验证。 But checking values on server side is a must too. 但是在服务器端检查值也是必须的。 Here is an examples for min and max . minmax的示例。

No; 没有; you can never rely on the client. 您永远不能依赖客户。 Always check on the server side as well. 还要始终在服务器端进行检查。

I've had success with the jQuery h5Validate plugin. 我已经成功使用jQuery h5Validate插件。 Its pretty simple in what it aims to accomplish (which is exactly what you want here). 它要完成的目标非常简单(这正是您想要的)。

Also, validate it on the server side too. 另外,还要在服务器端进行验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM