<select id="short_code">
<option value="12">First</option>
<option value="11">Second</option>
<option value="10">Third</option>
<option value="9">Fourth</option>
</select>
Run Code Online (Sandbox Code Playgroud)
我需要这样做:
if(document.getElementById("short_code").options.item(document.getElementById("short_code").selectedIndex).text)== "First")
//get the value of the option Fist , how to get the value?
Run Code Online (Sandbox Code Playgroud)
and*_*lrc 10
var elem = document.getElementById("short_code"),
selectedNode = elem.options[elem.selectedIndex];
if ( selectedNode.value === "First" ) { //...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
41739 次 |
| 最近记录: |