亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        javascript獲取select標簽選中的值

        字號:


            這篇文章主要介紹javascript獲取select標簽選中的值方法,比較實用,需要的朋友可以參考下。
            代碼如下:
            var obj = document.getElementById("testSelect"); //定位id
            var index = obj.selectedIndex; // 選中索引
            var text = obj.options[index].text; // 選中文本
            var value = obj.options[index].value; // 選中值
            jQuery中獲得選中select值
            第一種方式
            代碼如下:
            $('#testSelect option:selected').text();//選中的文本
            $('#testSelect option:selected').val();//選中的值
            $("#testSelect").get(0).selectedIndex;//索引
            第二種方式
            代碼如下:
            $("#tesetSelect").find("option:selected").text();//選中的文本
            $("#tesetSelect").find("option:selected").val();
            $("#tesetSelect").find("option:selected").get(0).selectedIndex;
            以上就是javascript獲取select標簽選中的值的全部內(nèi)容,希望能給大家一個參考