Prevent focus on field when it fails validation

后端 未结 4 1766
醉梦人生
醉梦人生 2021-01-12 14:14

I often use this jQuery validation plugin to validate forms and it works great. Really pleased with it, but when you press Submit on a form it automatically puts focus on th

4条回答
  •  天命终不由人
    2021-01-12 15:13

    Use the focusInvalid option and set it to false :

    $("#abc").validate({
      focusInvalid: false
    });
    

    Working example here and Documentation here (options tab)

提交回复
热议问题