Skip to main content


adds a new item into the list of Combobox options

addOption(value: obj | string, join?: boolean): void;


  • value: obj | string - required, the value of a new item
  • join: boolean - optional, if true (by default), adds the new item to the list of options selected in Combobox; if false, only the new item will be selected in Combobox


const combobox = new dhx.Combobox("combo_container", {
multiselection: true

console.log(combobox.getValue()); // -> u1664261657492,u1664261657494

combobox.addOption("Georgia", false);
console.log(combobox.getValue()); // -> u1664261657520

// check that the new item is added into the data collection

Adding an option as an object‚Äč

When you need an extended configuration, while adding an item, pass the value parameter as an object with a set of key:value pairs that represent attributes of a Combo option. Check the list of available attributes. For example:

"value": "Austria",
"src": "../common/flags/at.png"

The method invokes the beforeAdd and afterAdd events of the Data Collection object. If the beforeAdd event returns false, a new item won't be added into the data collection.

Change log:

  • The join parameter was added in v8.0
  • The method was added in v.7.3