Combo option colouring from <SELECT>

I create DHTMLX combos from selects, but I would like to be able to specify the css for each item (I actually need to differentiate between two different types of option in the list)

I can see that I can do this via script, for example:

myCombo = new dhtmlXCombo("combo_zone");
myCombo.addOption("1", "Walking through the city", "color:red;", null, true);
myCombo.addOption("2", "Looking oh so pretty", "color:green;");
myCombo.addOption("3", "I've just got to find my way", "color:blue;");
myCombo.addOption("4", "See the ladies flashing", "color:magenta;");

I’m wondering if it’s possible to do something like:

<option value="1" data-css="color:red;">Walking through the city</option>
<option value="2" data-css="color:red;">Looking oh so pretty</option>
<option value="3" data-css="color:green;">I've just got to find my way</option>
<option value="4" data-css="color:red;">See the ladies flashing</option>

Or any other way that I can differentiate options in the select as being of two different types (verified and not verified in my case).

Is this, or something like it, possible?


replace “data-css” with “css”

Thanks but I’m afraid that didn’t work for me. Any idea why that might be?

Is this functionality documented anywhere?


Walking through the city

this one above works fine localy while init from html

Got it working, my bad. Thanks for your help!