设置< select>颜色,FireFox 3.6.17问题 [英] seting <select> color, FireFox 3.6.17 issue

查看:99
本文介绍了设置< select>颜色,FireFox 3.6.17问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可以在Chrome,Opera,Safari和IE9中使用,但在FF中可以设置白色,为什么?? !!

this works in Chrome, Opera, Safari and IE9 but in FF it sets white color, WHY ??!!

请帮助我PLS

HTML

<select class="widocznosc">
    <option value="prywatna" class="note_0">prywatna</option>
    <option value="publiczna" class="note_2">publiczna</option>
    <option value="tylko dla grupy" class="note_16">tylko dla grupy</option>
</select>

CSS

.note_0
{color: #b59285;
}
.note_2
{color: #e7511e;
}
.note_16
{color: #6a89a5;
}
select.widocznosc
{border: none;
outline: 0;
background-color: #FAFAFA;
width: 110px;
}

jQuery

jQuery("select.widocznosc").change(function(){
        jQuery(this).css("color", jQuery(this).children("option:selected").css("color")); 
    }).change();

推荐答案

您可以改为更改类: 这是 JS Bin

You can change the class instead: Here is the code in JS Bin

更改的代码:

jQuery("select.widocznosc").change(function(){        
      jQuery(this).removeClass().addClass(jQuery(this).find("option:selected").
      attr("class"));
}).change();

这篇关于设置&lt; select&gt;颜色,FireFox 3.6.17问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆