I have a combo-box which works as a filter for a column. On changing any value in the column, I want to update the options in the combo-box.
obj.default gives me the old value of the changed field in the column.
function valueChange(obj) {
var optionsArray = document.getElementById('filter').options;
for (var index = 0; index < optionsArray.length; index++) {
if (optionsArray[index].value == obj.defaultValue) {
optionsArray[index].value = new Option(obj.value, obj.value);
}
}
}
optionsArray is getting populating correctly. How to set back optionsArray back to the element’s option?
Suppose we have the select in html
This is how we can add option