How to change style for disabled option in a select menu?

How to change style for disabled option in a select menu?

Hi
I am disabling some options in a select menu and enable the rest but i like to give class to the disable item. I want to change the color and put a image background to those disabled items


how can i change the color and add a background image?

here are my code to disable options

for(var i = 0; i <= 86400;  i += 1800){
var seconds = i.toString();
var newTime = i.toHHMMSS();
var titleSec = fromHHMMSS(title); //this needs to be converted to seconds
if(i < titleSec){
$('#startTime option[value="' + newTime + '"]').removeClass().addClass('disabledItem').attr('disabled', 'disabled');
} else {
$('#startTime option[value="' + newTime + '"]').removeClass().removeAttr("disabled"); 
if(flag == 0 ){
flag = 1;
$('#startTime').val( i.toHHMMSS() );
}
var nextSelected = i + 1800;
}
//console.log(newTime);
}




I have tried all this but none of them is doing it

option:disabled,
option[disabled],

select:disabled.disabledItem {
color: red;
}


    • Topic Participants

    • mike