hide-search.html 653 B

12345678910111213141516171819202122232425
  1. <section>
  2. <h1 id="hide-search">Hiding the search box</h1>
  3. <p>
  4. Select2 allows you to hide the search box depending on the number of
  5. options which are displayed. In this example, we use the value
  6. <code>Infinity</code> to tell Select2 to never display the search box.
  7. </p>
  8. <div class="s2-example">
  9. <p>
  10. <select class="js-example-basic-hide-search js-states form-control"></select>
  11. </p>
  12. </div>
  13. <pre data-fill-from=".js-code-hide-search"></pre>
  14. <script type="text/x-example-code" class="js-code-hide-search">
  15. $(".js-example-basic-hide-search").select2({
  16. minimumResultsForSearch: Infinity
  17. });
  18. </script>
  19. </section>