//**1.设置选中值:(根据索引确定选中值)**// var osel=document.getElementById("selID"); //得到select的ID var opts=osel.getElementsByTagName("option");//得到数组option var obt=document.getElementById("bt"); obt.onclick=function(){ opts[3].selected=tr
js函数方法: <script> function getDefaultSelectedOption(selectId, valIfNull) { var selectId = selectId.replace(/^#/, ''), opts; try { opts = document.getElementById(selectId).getElementsByTagName('option'); for (var i in opts) { if (opts[i].defaultSelect
//循环获取某个class下的多个select的选中值 function eachSelect(cla){ var val = ""; $("."+cla).each(function(){ $(this).find("select").each(function(){ var xm = $(this).children("option:selected").html(); var rybh = $(this).childre
js获取select标签选中的值 var obj = document.getElementById(”testSelect”); var index = obj.selectedIndex; var text = obj.options[index].text; var value = obj.options[index].value; jQuery中获得选中select值 $('#testSelect option:selected').text();//文本 $('#testSelect'
var obj = document.getElementByIdx_x(”testSelect”); //定位id var index = obj.selectedIndex; // 选中索引 var text = obj.options[index].text; // 选中文本 var value = obj.options[index].value; // 选中值 jQuery中获得选中select值 第一种方式$('#testSelect option:selected').text()