You can set the allowClear
option to true
.
$("#e6").select2({
allowClear: true,
placeholder: "Search for a movie",
...
When set to true
, the allowClear
option causes the Select2 control to display a clear button, but you must also specify the placeholder
option for it to work.
Here's a jsfiddle showing it work for a Select2 that uses ajax.