I have created one dropdown box
<select name="select" id="selectId">
<option id="" value="calendar_Second_Calendar_1285942672.xml">Second Calendar</option>
<option id="" value="calendar_First_Calendar_1285932160.xml">First Calendar</option>
</select>
I can get the selected drop down box value using
document.getElementById("selectId").value
How i can get the name where user is seeing i mean (Second Calendar or First Calendar)
I have created one dropdown box
<select name="select" id="selectId">
<option id="" value="calendar_Second_Calendar_1285942672.xml">Second Calendar</option>
<option id="" value="calendar_First_Calendar_1285932160.xml">First Calendar</option>
</select>
I can get the selected drop down box value using
document.getElementById("selectId").value
How i can get the name where user is seeing i mean (Second Calendar or First Calendar)
Share asked Oct 1, 2010 at 12:37 Shinu ThomasShinu Thomas 5,31612 gold badges62 silver badges88 bronze badges 02 Answers
Reset to default 7Give this a go:
var domNode = document.getElementById("selectId");
var value = domNode.selectedIndex;
var selected_text = domNode.options[value].text;
You can determine the name by a simple if else statements on the given value.