如何获取select控件的option值和Value?

案例:

  <select id="paId" class="text3">
                    <option value="0" selValue="selone">one<option>
                    <option value="1" selValue="selone">two</option>
                    <option value="2" selValue="selone">three<option>
                    <option value="3" selValue="selone">four<option>
     </select>

获取代码:   

   var selectText = $("#paId").find("option:selected").text();  //one  获取Select选择的Text 
   var selectValue = $("#paId").val();//0  获取Select选择的val()

   var selText = $("#paId option:selected").attr("selValue");  //selone 获取attr的值

 var docuProjectBigType = document.getElementById("paId");
 docuProjectBigType.selectedIndex = contractTypeId-1;

posted @ 2016-02-19 17:18  李寒星  阅读(1417)  评论(0编辑  收藏  举报