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 selected = true & lt; Options & gt; element containing & gt; Select the domain element.

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

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -