5

I can't find on select2 documentation a way to remove all the options in a select2 form. The old stckoverflow answers to this questions seem not to work since the new version (I'm using 4.0.3) has a different behavior

Dharman
  • 30,962
  • 25
  • 85
  • 135
user1403546
  • 1,680
  • 4
  • 22
  • 43

2 Answers2

16

Just

$('#id').empty().trigger("change");

Where '#id' is the jQuery selector for your select2 element.

0

Previous answer will delete all values, but in the official documentation it says:

$("#id").val(null).trigger("change");

greatgumz
  • 408
  • 3
  • 17