原生js方法:
var myselect=document.getElementById("test");
var index=myselect.selectedIndex;
var value=https://bbs.csdn.net/topics/myselect.options[index].value;
jquery方法:
var options=$("#test option:selected");
options.val();//獲取value
options.text();//獲取文本
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/70119.html
標籤:JavaScript
上一篇:獲取節點內容的路徑
