<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                ## 這兩種方式取不到索引值 ``` $('#select_id').find('option:selected').selectedIndex; $('#select_id').find('option:selected').attr('selectedIndex'); ``` 5.設置select 選中的索引: ``` $("#select_id").get(0).selectedIndex=index;//index為索引值 ``` ``` 3. $("#select_id option[text='jQuery']").attr("selected", true); //設置Select的Text值為jQuery的項選中 ,我這里沒用 var cc1 = $(".formc select[@name='country'] option[@selected]").text(); //得到下拉菜單的選中項的文本(注意中間有空格) var cc2 = $('.formc select[@name="country"]').val(); //得到下拉菜單的選中項的值 var cc3 = $('.formc select[@name="country"]').attr("id"); //得到下拉菜單的選中項的ID屬性值 ``` ## jQuery添加/刪除Select的Option項: ``` 4. $("#select_id option[index='0']").remove(); //刪除Select中索引值為0的Option(第一個) //我這里不能用 5. $("#select_id option[text='4']").remove(); //刪除Select中Text='4'的Option //我這里不能用 ``` ## 不能用的 9.刪除select中值為value的項 (我這里不能用) ``` var count = $("#select_id").size(); for(var i=0;i<count;i++) { if($("#select_id").get(0).options[i].value == 'value') { $("#select_id").get(0).remove(i); break; } } ``` 7.設置select 選中的text: 1> //我不能用 ``` var count=$("#select_id").get(0).options.length; for(var i=0;i<count;i++) { if($("#select_id").get(0).options.text == text) { $("#select_id").get(0).options.selected = true; break; } } ``` 6.設置select 選中的value: ``` $("#select_id").attr("value","Normal"); //我不能用 $("#select_id").get(0).value = "Normal"; //我不能用 ``` 需要注意的是,這里的代碼好多是針對jquery 1.32以前的版本(以后的版本已經不支持@),所以替換為空測試下即可。 ``` //遍歷option和添加、移除option function changeShipMethod(shipping){ var len = $("select[@name=ISHIPTYPE] option").length if(shipping.value != "CA"){ $("select[@name=ISHIPTYPE] option").each(function(){ if($(this).val() == 111){ $(this).remove(); } }); }else{ $("<option value='111'>UPS Ground</option>").appendTo($("select[@name=ISHIPTYPE]")); } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看