Hey all!
Anyone encounter this one before?
I have a SELECT list and am dividing it into OPTGROUPs. The SELECT has an ONCHANGE event associated with it, but get this: it doesn't fire when using the up/down arrow keys to change options from the last of one optgroup to the first of another or back!
Here's a little code to show you what I mean:
From the drop-down, choose 'Gummo'. You should get an alert that says 'hey!'.
Then use your down-arrow to choose 'Bud Abbot'. It's at this point I would expect another 'hey!', but nothing comes.
Use your up-arrow to go back. Again, nothing.
Use your up- or down-arrows to get between any other two options (i.e., staying within a single OPTGROUP) and you get the expected 'hey!' message.
Bug?
This is a hypothetical scenario, but not too far-removed from my actual need (only the names have been changed...). The solution I'm looking at is to have two drop-downs where the first determines the options selectable in the second.
To tell you the truth, I'm not a fan of OPTGROUPs, but in the particular project I'm working on, it feels right to use them, so if someone has a better solution than my two-drop-down-list solution mentioned above, I'd love to hear it!
--Dave
Anyone encounter this one before?
I have a SELECT list and am dividing it into OPTGROUPs. The SELECT has an ONCHANGE event associated with it, but get this: it doesn't fire when using the up/down arrow keys to change options from the last of one optgroup to the first of another or back!
Here's a little code to show you what I mean:
Code:
<html>
<head>
<title>select list optgroup</title>
</head>
<body>
<select onchange='alert("hey!")'>
<optgroup label='Marx Brothers'>
<option>Groucho</option>
<option>Chico</option>
<option>Harpo</option>
<option>Zeppo</option>
<option>Gummo</option>
</optgroup>
<optgroup label='Abbot and Costello'>
<option>Bud Abbot</option>
<option>Lou Costello</option>
</optgroup>
</select>
</body>
</html>
From the drop-down, choose 'Gummo'. You should get an alert that says 'hey!'.
Then use your down-arrow to choose 'Bud Abbot'. It's at this point I would expect another 'hey!', but nothing comes.
Use your up-arrow to go back. Again, nothing.
Use your up- or down-arrows to get between any other two options (i.e., staying within a single OPTGROUP) and you get the expected 'hey!' message.
Bug?
This is a hypothetical scenario, but not too far-removed from my actual need (only the names have been changed...). The solution I'm looking at is to have two drop-downs where the first determines the options selectable in the second.
To tell you the truth, I'm not a fan of OPTGROUPs, but in the particular project I'm working on, it feels right to use them, so if someone has a better solution than my two-drop-down-list solution mentioned above, I'd love to hear it!
--Dave