467,867 Members | 1,271 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,867 developers. It's quick & easy.

How to get a selected value from <Select> using DOM

Hi All,

Can any one help me, how to get the selected value from <Select> tag
using DOM
I tried with
document.getElementById("selectTagId").getAttribut e("value") it's
working fine with IE but not with NN I have checked it on NN 7.1

Thanks in advance

Jul 20 '05 #1
  • viewed: 163708
Share:
1 Reply
Raghuram Banda <ra************@nokia.sify.net> writes:
Can any one help me, how to get the selected value from <Select> tag
using DOM I tried with
document.getElementById("selectTagId").getAttribut e("value") it's
working fine with IE but not with NN I have checked it on NN 7.1


document.getElementById("selectTagId").value
works in modern browsers. For Nestscape 4 and other old browsers,
you must get the value from the selected option (works in newer
browsers too):

var sel = document.getElementById("selectTagId");
sel.options[sel.selectedIndex].value;

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Laphan | last post: by
1 post views Thread by ghadley_00 | last post: by
5 posts views Thread by = poster = | last post: by
12 posts views Thread by LayneMitch via WebmasterKB.com | last post: by
reply views Thread by jack112 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.