I am using the following HTML code to include a select2 control in my form as below.
<select id="element_id" class="select2" style="width:100%">
<option value="e1" >Element 1</option>
<option value="e2" >Element 2</option>
<option value="e3" >Element 3</option>
</select>
I am using the following style to format the font of the list items and selected item.
<style>
#s2id_element_id .select2-container--default .select2-selection--single .select2-selection__rendered
{
color: green ;
}
</style>
This does not color the list items and selected item in green color. Note: I only need this specific select box to have the style but not others. So I am using the css id selector for specific select2 control.
Thanks.