select2 and jquery validation not working properly

后端 未结 2 1624
说谎
说谎 2020-11-29 13:13

Trying to use validation on select2 with a few issues :

  • the error message will show, but it will not remove when a valid entry is entered.

  • I

2条回答
  •  我在风中等你
    2020-11-29 13:26

    I was facing the same issue. You can try the below code to make it work. Select 2 add style display: none to the select. That's the reason form validation doesn't work as it's hidden. To override the validation and allow them to validate the hidden fields too.

     $(document).ready(function () {
            //Validate form mainly SELECT 2
            var $form = $("#your-form-id");
            $form.validate().settings.ignore = [];
        });
    

提交回复
热议问题