简体   繁体   English

将CSS应用于下拉菜单

[英]Apply css to dropdown

I am trying to apply css to dropdown whose values are select. 我正在尝试将css应用于选择其值的下拉列表。 I am trying this example. 我正在尝试这个例子。 But this code not applying the background. 但是这段代码没有应用背景。 http://jsfiddle.net/Bzbkn/1/ http://jsfiddle.net/Bzbkn/1/

Your inner loop is selecting the list items, but you need to apply the background color to the select box. 您的内部循环正在选择列表项,但是您需要将背景色应用于选择框。

Replace 更换

$(this).css('background-color', '#FFFF99');

With

$(this).parent().css('background-color', '#FFFF99');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM