multiple-max.html 738 B

12345678910111213141516171819202122232425262728
  1. <section>
  2. <h1 id="multiple-max">
  3. Limiting the number of selections
  4. </h1>
  5. <p>
  6. Select2 multi-value select boxes can set restrictions regarding the
  7. maximum number of options selected. The select below is declared with
  8. the <code>multiple</code> attribute with <code>maximumSelectionLength</code>
  9. in the select2 options.
  10. </p>
  11. <div class="s2-example">
  12. <p>
  13. <select class="js-example-basic-multiple-limit js-states form-control" multiple="multiple"></select>
  14. </p>
  15. </div>
  16. <pre data-fill-from=".js-code-multiple-limit"></pre>
  17. <script type="text/x-example-code" class="js-code-multiple-limit">
  18. $(".js-example-basic-multiple-limit").select2({
  19. maximumSelectionLength: 2
  20. });
  21. </script>
  22. </section>