I want to change the placeholder on a select2 enhancing control upon an event.
So I've got this...
<select id="myFoo" placeholder="Fight some foo...">
...which is then enhanced:
init: function(){
$('#myFoo').select2();
},
...so now it has its correct placeholder.
But then I want it to react to an event and clear the placeholder...
someButtonPress: function(){
// $('#myFoo').placeholder("");
// $('#myFoo').attr('placeholder', "");
// $('#myFoo').select2('placeholder',"");
// $('#myFoo').select2({placeholder:""});
// none of these work
}
This seems so basic, yet I'm stumped.
I can't find anything in the docs. Am I looking in the wrong place?
$('#myFoo').select2('placeholder',"Fight some foo...")'
, then you might be able to clear it with the same function – Morganite