js 获取 select的option的 id值
生活随笔
收集整理的這篇文章主要介紹了
js 获取 select的option的 id值
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
<select >
<option value="">--請(qǐng)選擇--</option><option id="1" value="1">--1--</option><option id="2" value="2">--2--</option>
</select>
js
var selectIndex =document.getElementById("usertype").selectedIndex;var activeName_value =document.getElementById("usertype").options[selectIndex].id;alert(activeName_value);jquery
$("#usertype option:selected").text() $("#usertype").find("option:selected").text()總結(jié)
以上是生活随笔為你收集整理的js 获取 select的option的 id值的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 视频播放测试
- 下一篇: 去重数组里面重复数据