javascript - Validate Chosen Multi Selection with Parsley.js -


i managed parsleyjs.org validate "required" chosen dropdown can't seem able validate multi selection dropdown.

i have tried apply max , min validation rules, did not work.

i have setup parsleyjs.org , choosen on test site here: http://loai.directory/test/test/blank.php

how can validate min , max on multi selection dropdwon parsleyjs?

you should use data-parsley-mincheck that. following example works expected (jsfiddle demo).

<form id="myform">     <select name="[]" multiple="multiple" data-parsley-required data-parsley-mincheck="2">         <optgroup label="section">             <option>drop down option a</option>             <option>drop down option b</option>         </optgroup>         <optgroup label="section">             <option>drop down option a</option>             <option>drop down option b</option>         </optgroup>     </select>      <input type="submit" /> </form>  <script> $(document).ready(function() {     $("select").chosen();      $("#myform").parsley(); }); </script> 

Comments