How do I change the data placeholder with select2?
So far I've tried this.
$("#city").select2({placeholder:"foo"});
And this...
$("#city").attr("data-placeholder","bar");
But neither works.
I found that if I just set the attr e.g. $("#city").attr('data-placeholder', 'bar')
, there is no effect. However, if I set the attr and then call $("#city").select2()
with no arguments, then the placeholder updates.
e.g.
$("#city").attr("data-placeholder","bar");
$("#city").select2();