在 Chrome 和 IE7-9 运行良好的同时,firefox 带来了另一个惊喜......
我要做的是根据所选选项
的颜色更改Select
的颜色。出于某种神秘的原因,它在 Firefox 中不起作用。
有什么想法吗?
$('#selectstat_sch').change(function(){
$(this).css('color',$('option:selected',this).css('color'));
}).trigger('change');
最佳答案
详细说明未定义,我们可能想先验证我们的 css 属性,
如果存在其他一些属性,这也应该有效。
var style=$('option:selected',this).attr('style');
var matches=style.match(/color:([^;]+)/);
if (matches) $(this).css('color',matches[1]);
//else alert('no match');
关于jquery - firefox css 错误/问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12437515/