jquery-select2 Getting started with jquery-select2 To clear the selected elements of Select2 dropdown.

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

In order to clear the selection of those values which are selected using a Select2 drop down,we can use the empty() function.

<select id="select2_example">
<option>Option1</option>
<option>Option2</option>
<option>Option3</option>
</select>

The dropdown can be reset using Jquery.

$("#select2_example").empty();

It can also be reset as below.

$("#select2_example").select2("val", "");


Got any jquery-select2 Question?