2012-04-29 82 views
0

我有一个选择菜单下面的代码:获取所选项目的字符串值中选择菜单

<label for="select-choice-0" class="select">Shipping method:</label> 
<select name="select-choice-0" id="select-choice-1"> 
    <option value="standard">Standard: 7 day</option> 
    <option value="rush" >Rush: 3 days</option> 
    <option value="express">Express: next day</option> 
    <option value="overnight">Overnight</option> 
</select> 

做$(“选择选-1”)VAL()会给我的价值例如,如果已经选择了第二选项,则返回的值将是“仓促的”。

但是我想要取得字符串“Rush:3天”。我怎样才能做到这一点?

谢谢。

回答

0

找到了以下工作:

document.getElementById('select-choice-1').options[document.getElementById('select-choice-1').options.selectedIndex].text; 
相关问题