Can I allow users to clear their selections?
You can allow people to clear their current selections with the allowClear
option when initializing Select2. Setting this option to true
will enable an "x" icon that will reset the selection to the placeholder.
{% highlight js linenos %}
$('select').select2({
placeholder: 'This is my placeholder',
allowClear: true
});
{% endhighlight %}
Why is a placeholder required?
{% include options/not-written.html %}
The "x" icon is not clearing the selection
{% include options/not-written.html %}
Can users remove all of their selections in a multiple select at once?
{% include options/not-written.html %}