Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I change the color of Disabled HTML Select Element in IE?

I have a requirement of changing the color of a html select. I have search a lot but was not find a sample that works in IE. So, can I change the color of Disabled HTML Select Element in IE? I need a sample, in css or javascript or in jquery. Here is what I have tried.

<select disabled="disabled">
    <option value="a">option A</option>
    <option value="b">option B</option>
    <option value="c">option C</option>
</select>

[disabled] {
  color: #933;
  background-color: #ffc;
}


select:disabled
{
    border: solid 1px silver;
    background-color: #F9F9F9;
    color:blue;
}


[disabled] option {
    background-color: #ffc;  color: #933;
}
like image 883
Imran Qadir Baksh - Baloch Avatar asked Dec 22 '12 14:12

Imran Qadir Baksh - Baloch


1 Answers

The solution is to use the ::-ms-value selector:

select[disabled]::-ms-value {
    color: red;
}
like image 188
Jon Grant Avatar answered Sep 27 '22 16:09

Jon Grant