How to make select2 work with jquery.validation plugin?

后端 未结 15 624
北荒
北荒 2020-12-01 02:40

I\'m trying to validate select2 field using jquey.validation plugin but nothing happens.

I want to make select required field.

I\'m using this custom validat

15条回答
  •  一个人的身影
    2020-12-01 03:41

    This doesn't work in Bootstrap Validator() because the validator includes all the inputs in the form. This means it will validate the input search field of the select2 plugin. which will interfere with the multiselect validation

    To fix this simply go to the validator.js Add the select2 input search class .select2-search__field to the ignore list:

    Validator.INPUT_SELECTOR = ':input:not([type="submit"], button, .select2-search__field):enabled:visible'
    

提交回复
热议问题