OptGroup elements can not be selected


#1

Here is a codepen that show how a select with multiple optgroup elements is unable to select some of the children.

Is this a bug ?


#2

It appears you have some data errors. I can select most child items, and those I can’t select have issues in their data objects:

  • {id:"one",text:"Switches & Relays"}: this item has the same “id” value as another item in the Select2 (the “first” item, select2_ary.push({id: "one", text: "one"}). Item IDs must be unique within the Select2.
  • All the other unselectable child items are missing either their “text” or “id” properties. Both of these properties are required.

#3

Thanks very much. Just discovered this myself, apologies for bad post. Thanks Again
Updated codepen with good data