IE Select Option Bug - Selected, SelectedIndex
April 17th, 2008
In case anyone else is coming across this issue, for some reason, when attempting to select all options in a multi-select “<select>” box, for some reason, IE doesn’t work the first time through my iteration. Here is more:
WORKAROUND
Don’t set Multiple immediately before selecting options
Alright, I found it - for some reason, when you use javascript to set the “multiple=true”, you cannot then immediately set selected=’true’. It just doesn’t work in Internet Explorer. (Or at least we couldn’t get it to work - please let us know if you find another solution).
The Old Function
function selectAll(selector){
if(!selector)alert('Selector doesnt exist');
else{
selector.multiple=true;
for(var i=0;i
}
return false;
}
}
The New
function selectAll(selector){
if(!selector)alert('Selector doesnt exist');
else{
/**selector.multiple=true; Call this far in advance, or have it already set to “multiple”**/
for(var i=0;i
}
return false;
}
}






Leave a Reply
You must be logged in to post a comment.