How to force form client-side validation in or before $.ajax()

后端 未结 4 1815
难免孤独
难免孤独 2020-12-19 00:34

I have a form and unobtrusive validations are enabled. By default in submit method client side validation gets triggered and (if you have any errors) the form looks like thi

4条回答
  •  一个人的身影
    2020-12-19 01:09

    I was having the same issue Yablargo was having in that it was saying that valid is not a function, so I came up with this:

    For the onclick handler of the submit button, I put this:

    onclick="return $(this).closest('form').checkValidity();"

提交回复
热议问题