min max number in text input - Jquery/javascript

僤鯓⒐⒋嵵緔 提交于 2019-12-19 10:27:58

问题


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.


回答1:


Use jquery validator plugin. 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.




回答2:


No; you can never rely on the client. Always check on the server side as well.




回答3:


I've had success with the jQuery h5Validate plugin. Its pretty simple in what it aims to accomplish (which is exactly what you want here).

Also, validate it on the server side too.



来源:https://stackoverflow.com/questions/4858949/min-max-number-in-text-input-jquery-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!