Gabriel García Seco Gabriel García Seco - 4 months ago 13x
jQuery Question

Select2 reset to placeholder

I know this is repeated. I searched everywhere and I cannot see where my problem is.

I want to reset the selected value to placeholder.

I have a codepen running in case anyone wants to see the code.

I am using the last version of select2

placeholder:'A SELECT EXAMPLE',

$("#reset").on('click', function(e){
console.log('e', e);
var $select = $("#select")[0];
$($select).select2('val', '');


Not sure what is causing you the problem here, because it should have just worked fine. But a little trick here could get you what you want. Just set original select element's value to empty and trigger its change event.


$("#reset").on('click', function(e){

Updated Pen HERE