一:JavaScript原生的方法
1:拿到select對象: var myselect=document.getElementById(“test”); 2.拿到選中項的索引: var index=myselect.selectedIndex ; // selectedIndex代表的是你所選中項的index 3:拿到選中項options的value: myselect.options[index].value; 4:拿到選中項options的text: myselect.options[index].text;
二:jQuery方法(前提是已經加載了jquery庫)
1.獲取選中的項: var options=$(“#test option:selected”); 2.拿到選中項的值: alert(options.val()); 3.拿到選中項的文本: alert(options.text());
