Prevent user from typing in input at max value

前端 未结 7 1938
遥遥无期
遥遥无期 2020-12-30 04:41

I\'d like the user to be blocked from typing more if the value is over 100. So far I have the following from reading different posts:

$(\'.equipCatValidation         


        
7条回答
  •  旧时难觅i
    2020-12-30 05:38

    It is bad UI to disable the input if a user inputs a bad value. I'm assuming you simply want to put a max value that the user cannot go over. If so, you can either clamp the value, or use the max attribute in your markup:

      

    If you input an invalid value, the input will turn red, and you cannot submit the form.

提交回复
热议问题