Below code doesn't seem to change the background color of dropdownlist. Please advice.
var TextHighlightCss = {
'background': '#FFFFAA',
'border': '1px solid #FFAD33'
};
$('#ddlCarriers option:selected').css('TextHighlightCss');
Thanks in advance
BB
Please do it like this, if you can help it:
CSS:
JS:
Guy who needs to refactor it in the future:
(n/a)
You're passing a string, not your variable.
Remove the apostrophes from the .css() part and it should work.
Also, you may like to see this:
http://www.456bereastreet.com/lab/form_controls/select/
It shows the style differences between all browsers for select menus, quite handy.