Getting displayed value of select tag
html, javascript
Solution
The solution you are looking for is:
To get the value:
var element = document.getElementById("kamal");
var selectedValue = element.options[element.selectedIndex].value;
To get the text:
var element = document.getElementById("kamal");
var selectedValue = element.options[element.selectedIndex].text;
EDIT:
working example at:
http://jsfiddle.net/n85tW/6/
Problem
``` <select id="kamal"> <option value"ACTIVE">a<option> <option value"DISABLED">b<option> <option value"DELETED">c<option> </select> ``` I want to get the value displayed on the page..not the value shown in the option tag I am interested in "aktiv" not "ACTIVE" when i write `document.getElementById("kamal").value;`then the value that is select comes in the variable. But I want the displayed value. Please help me how can I take this value. NOTE: By using all the options given below, it will give me the value of the selected option, I want the label of the selected option. I mean the displayed value on html page.