I want to style the selected item of the asp:DropDownList, the rest of the item may have default or some other style. Note that here Selected Item means the item which is finally visible after the selection is made.
I have used:
ddlID.Items[0].Attributes.CssStyle.Add("background-color", "yellow");
$("#ddlID option:first").css("background-color", "yellow");
ddlID.SelectedItem.Attributes.CssStyle.Add("background-color", "yellow");
$("#ddlID option:selected").css("background-color", "yellow");
None of the above worked for me the first two style the first item of the list and the last two style the item which is been selected in the list only.
I would prefer CSS to accomplish the task if possible.