clearing-selections.html 819 B

12345678910111213141516171819202122232425262728293031323334
  1. <section>
  2. <h2 id="allowClear">
  3. Can I allow users to clear their selections?
  4. </h2>
  5. <p>
  6. You can allow people to clear their current selections with the <code>allowClear</code> option when initializing Select2. Setting this option to <code>true</code> will enable an "x" icon that will reset the selection to the placeholder.
  7. </p>
  8. {% highlight js linenos %}
  9. $('select').select2({
  10. placeholder: 'This is my placeholder',
  11. allowClear: true
  12. });
  13. {% endhighlight %}
  14. <h3>
  15. Why is a placeholder required?
  16. </h3>
  17. {% include options/not-written.html %}
  18. <h3>
  19. The "x" icon is not clearing the selection
  20. </h3>
  21. {% include options/not-written.html %}
  22. <h3>
  23. Can users remove all of their selections in a multiple select at once?
  24. </h3>
  25. {% include options/not-written.html %}
  26. </section>