jQuery Validation - form.valid() always returning true

前端 未结 3 1975
再見小時候
再見小時候 2021-01-05 00:02

I have a situation when I try to check if a form is valid, but form.valid() always returns true. But if I try to validate the individual control, it returns false.

T

3条回答
  •  感动是毒
    2021-01-05 00:48

    You should add required to the input

    
    

    See working demo here

    For unobtrusive HTML 5-compatible attributes describe the validators to be attached to the input fields data-val="true".

    See more info here

提交回复
热议问题