how to change the css of default select2 placeholder color?
If I understand what you want correctly, you probably want to use this selector.
Original CSS which make the placeholder gray
.select2-default {
color: #f00 !important;
}
Change your preferred placeholder color
.select2-default {
color: #f00 !important;
}
Specific placeholder color (using id)
#s2id_<elementid> .select2-default {
color: #f00 !important;
}
Replace with the original input
or select
id
In this case
#s2id_leadadd_mode_of_enq .select2-default {
color: #f00 !important;
}
Also, another note for placeholder to work, you have to add an empty <option></option>
or else the first option will be automatically selected, but not the placeholder.
Like so
<select id="leadadd_mode_of_enq" name="leadadd_mode_of_enq" class="select2 req_place" data-select-search="true" placeholder="Mode of enquiry">
<option></option>
<option value="1">Opt1</option>
<option value="2">Opt2</option>
</select>
See Demo
the answers given are old and you can now use the css class
.select2-selection__placeholder {
color: #FF0000;
}