0

I tried below code to change color of few disabled select items though its working in Chrome but not in IE. I tried giving ::ms-value, but it is applied to all disabled select fields to which color red is not required. Is there any way i can do it in Jquery ? css also is fine . Thank you

HTML

 <select class="select_red" disabled="">
    <option>--Select--</option>
    <option class="red">one</option>
    <option>two</option>
    <option class="red">three</option>
    <option>four</option>
 </select>

Script

jQuery(document).on("change", ".select_red", function(event){
if($(this).find("option:selected").hasClass("red")){
    $(this).addClass("redtext");
}else {
    $(this).removeClass("redtext");
}

CSS

 .redtext{color:#f00 !important;}   
 .redtext, .select_red:disabled{color:#f00 !important;}
Nit
  • 1
  • 4

1 Answers1

-1

I'm not sure that you can. Each browser has their own way to style these. You could however make your own!

Flight Dude
  • 133
  • 7