Attach class to addOption element?

Found your website and it’s script and figured they would come in real handy for me… However how can I add a css class to an option element.

in a css file:

.dhx_combobox-action {

    color: #000000;

    text-indent: 22px;

    font-weight: bold;

    font-size: 11px;

    margin-right: 2px;

    background: #ffff99 url("…/imgs/gear.png") 4px 3px no-repeat;


In my html page:

    var z = dhtmlXComboFromSelect(‘customerid’);


    z.addOption(‘TV’,‘Test Valuation’,‘dhx_combobox-action") 4px 3px no-repeat;’);

    z.attachEvent(“onChange”,function(){ if(z.getActualValue()==“NEW”) { if(confirm(“Are you sure you want to create a new client? Any changes you’ve made will be discarded.”)) { window.location=“Contents.php”; } else { } } else { } });

Everything seems to be working so far except the css. :slight_smile:


combo allows to set css string as an attribute. It can be done as follows:

z.addOption([{‘value’:‘TV’,‘text’:‘Test Valuation’,‘css’:‘color: #000000; text-indent: 22px; font-weight: bold;…’}]);