Forum Moderators: open
I'm stumped as to why this simple javascript won't rewrite a select menu's options to set the first one to "selected".
var theElements = new Array();
theElements[0] = "filter_request_3";
theElements[1] = "filter_request_4";
theElements[2] = "filter_request_5";
theElements[3] = "filter_request_6";
theElements[4] = "local_base";
for (i=0;i<theElements.length;i++) {
document.getElementById(theElements[i]).options[0].selected = true;
}
Is there a syntax thing I'm missing regarding the getElementById() portion?
FWIW, the for loop works great, and traverses the array just fine. It's just the select menu option isn't ever changed.
Any ideas appreciated!
Glenn