internet explorer 6 - IE6: get value of a DOM select element -
So I'm having a cross browser javascript problem.
I have a and lieutenant; Some descendants with
domain element. selected = true
& lt; Options & gt;
element containing & gt; Select the
In Firefox, I just select select_elt.value
to get the value of the selected option, but it seems that in IE 6 (which I need to support) Do not have to work.
I chose select_elt.getElementsByTagName ('Options')
selected & lt; Option & gt; To search for
, which I could do, but option_elt.value
still does not give me the value of that option.
So what is the proper way to get the value of an option or to select the element in IE6?
(Yes, I know that I should switch to jQuery or some other crossslaptor library, and I can do so, but now I'm curious about it How to make all in IE 6
This is the most Cross-browser is a compatible way (in my experience):
var mySelect = document.getElementById ('mySelect'); Warning (mySelect.options [mySelect.selectedIndex] .Value );
Comments
Post a Comment