multiple-max.html 649 B

123456789101112131415161718192021222324
  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. {% highlight js linenos %}
  17. $(".js-example-basic-multiple-limit").select2({
  18. maximumSelectionLength: 2
  19. });
  20. {% endhighlight %}
  21. </section>