मैं इसे SELECT तत्व के पृष्ठभूमि रंग को पहले सेट करके करने में सक्षम था जिसके परिणामस्वरूप मैं सभी रंगों को रंग देता था। तब मैंने सभी विकल्पों को एक विशिष्ट रंग योजना बनाई। आखिरकार मैंने चयनित विकल्प को एक ही रंग योजना को चयन तत्व के रूप में चुना ताकि विकल्प ड्रॉप डाउन सूची में एक ही रंग दिखाता हो।
$.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');
});
क्या आप हमें अपना एचटीएमएल और सीएसएस दिखा सकते हैं? Fyi ... स्टाइल चुनने के बक्से बहुत मुश्किल है! –
शायद नहीं, नहीं; प्रतीत होता है कि ब्राउज़र में 'चयन' तत्वों की स्टाइल तक सीमित पहुंच है। –