Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] IE verses the option element onclick event


  • From: blmatthews at gmail.com (Brian L. Matthews)
  • Subject: [Javascript] IE verses the option element onclick event
  • Date: Fri Dec 30 21:45:09 2005

>Suggestions of where to look for a QaD answer of how to determine 
>which <option /> was selected when the onchange event fires for the 
><select />.

Given

sel = document.getElementById('selectElementId');

then sel.selectedIndex is the the index into sel.options of the 
currently selected option. So when onchange fires on the select 
element, sel.options[sel.selectedIndex] is a reference to the Option 
instance of the selected option.

And as an aside, I don't know that onchange on the option not firing 
is a bug. The value of the option isn't changing if you select it or 
select a different one, it's the value of the select that's changing, 
so I'd expect its onchange to fire, as it does.

Hope this helps.

Brian