I am using javascript and IE11 to implement the code below to add options in a combo box by using javascript
var bSelected = false;
for (count of elements to be created)
{
**// set value and text and whether to selected the element or not**
// Create an option and add it to the combo
opt = document.createElement ("option");
opt_txt = document.createTextNode (textPart);
opt.appendChild (opt_txt);
opt.setAttribute ("value", valuePart);
opt.setAttribute ("text", textPart);
opt.setAttribute ("selected", bSelected);
}
Now even if selected is set to false, opt.selected attribute it always comes out as true. As soon as element is created by createElement function, the default value is true. Please help why it is not changing to false ?
In IE9, it works fine (different HTML version?)