Hi all,
This is something I spent way too much time on, trying to figure out why
it didn't want to do what I wanted in IE7.
I'm posting it here, so maybe it will save some others a bit of time.
The problem: You have a <select> and you wish to deselect all options.
It turns out that you need to change the code, depending on whether
you're using a select that can take multiple options or not. Both
versions work in FF and Safari for both variants, but for Internet
Explorer you'll need to use them as specified below.
Case 1:
<select id='selectmenu' multiple='multiple' size='4'>
<option value='1'>One</option><option value='2'>Two</option><option
value='3'>Three</option>
</select>
<p id='clickme'>Click me to deselect all</p>
To make this work in IE, You'll need to use:
$('#clickme').click(function() {
$('#selectmenu option').attr('selected', false);
});
Case 2:
<select id='selectmenu' size='4'>
<option value='1'>One</option><option value='2'>Two</option><option
value='3'>Three</option>
</select>
<p id='clickme'>Click me to deselect all</p>
To make this work in IE, You'll need to use:
$('#clickme').click(function() {
$('#selectmenu').attr('selectedIndex', '-1');
});
Best, Bob.
--
Bob den Otter - [EMAIL PROTECTED]
Two Kings - www.twokings.nl - 070 345 76 28