How to make placeholder for select2 jQuery plugin. On StackOverflow many answers how to make placeholder there, but they about element\'s placeholder. I need to specify a pl
You can use the event:
select2:opening: Triggered before the dropdown is opened. This event can be prevented
It's enough to add the placeholder attribute in this event:
$(this).data('select2').$dropdown.find(':input.select2-search__field').attr('placeholder', 'My Placeholder')
$('select').select2({
placeholder: 'Select an option'
}).on('select2:opening', function(e) {
$(this).data('select2').$dropdown.find(':input.select2-search__field').attr('placeholder', 'My Placeholder')
})