Change Placeholder text on open (event)

24 views
Skip to first unread message

benjamin...@gmail.com

unread,
Oct 7, 2016, 2:03:03 PM10/7/16
to select2
I am trying to change the placeholder text to "Search..." when the dropdown is open.

I've tried:

$selector.on("select2:open", function (e) {
placeholder: "Search..."
});

this makes it so no results show on opening the dropdown and is replaced by a box that says "Searching..." which is odd. No erros.

and

$selector.on("select2:open", function (e) {
$selector.select2({
placeholder: "Search..."
});
});

This doesn't work either and has an error Uncaught TypeError: Cannot read property 'query' of null select2

I'm guessing because select2 was already instantiated.

This seems like something that should be easy to do - change properties on an event such as 'open' but I can't seem to find anything that works.

Reply all
Reply to author
Forward
0 new messages