How to set the options of select dynamically?
<p>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.</p>

<pre><code>function valueChange(obj) {
        var optionsArray = document.getElementById('filter').options;
        for (var index = 0; index &lt; optionsArray.length; index++) {
            if (optionsArray[index].value == obj.defaultValue) {
                optionsArray[index].value = new Option(obj.value, obj.value);
            }
        }
    }
</code></pre>

<p><code>optionsArray</code> is getting populating correctly. How to set back <code>optionsArray</code> back to the element's option?</p>
