Önce SELECT öğesinin arka plan rengini istediğim şekilde ayarlayarak, tüm seçenekler o renkle sonuçlandı. Sonra tüm seçenekleri belirli bir renk şeması yaptım. Son olarak, seçilen seçeneği SELECT öğesine aynı renk şemasında yaptım, böylece seçenek açılır listede aynı rengi gösterir.
$.each($('select'), function(i,v) {
theElement = $(v);
theID = theElement.attr('id');
// Set the SELECT input element to green background with white text
theElement.css('background-color', 'green');
theElement.css('color', 'white');
// Set all the options to another color (note transparant will show the green)
$('#'+theID).find('option').css('background-color', 'white');
$('#'+theID).find('option').css('color', 'black');
// Finally set the selected option to the same values as the SELECT element
$('#'+theID).find('option:selected').css('background-color', 'green');
$('#'+theID).find('option:selected').css('color', 'white');
});
Bize html ve css gösterebilir misiniz? Fyi ... stil seçme kutuları çok zor! –
Muhtemelen hayır, hayır; tarayıcılar, 'select' öğelerinin stiline sınırlı erişime sahip gibi görünüyor. –