admin管理员组文章数量:1323330
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.
本文标签: phpGetting Selected name of a dropdown using JavascriptStack Overflow
版权声明:本文标题:php - Getting Selected name of a dropdown using Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742139049a2422498.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论