JQuery 獲取和設(shè)置Select選項(xiàng)的代碼

    時(shí)間:2024-07-02 07:55:06 jQuery Mobile 我要投稿
    • 相關(guān)推薦

    JQuery 獲取和設(shè)置Select選項(xiàng)的代碼精選

      獲取Select :

      獲取select 選中的 text :

      $("#ddlRegType").find("option:selected").text();

      獲取select選中的 value:

      $("#ddlRegType ").val();

      獲取select選中的索引:

      $("#ddlRegType ").get(0).selectedIndex;

      設(shè)置select:

      設(shè)置select 選中的索引:

      $("#ddlRegType ").get(0).selectedIndex=index;//index為索引值

      設(shè)置select 選中的value:

      $("#ddlRegType ").attr("value","Normal“);

      $("#ddlRegType ").val("Normal");

      $("#ddlRegType ").get(0).value = value;

      設(shè)置select 選中的text:

      var count=$("#ddlRegType option").length;

      for(var i=0;i<count;i++)

      { if($("#ddlRegType ").get(0).options[i].text == text)

      {

      $("#ddlRegType ").get(0).options[i].selected = true;

      break;

      }

      }

      清空 Select:

      $("#ddlRegType ").empty();

    【JQuery 獲取和設(shè)置Select選項(xiàng)的代碼】相關(guān)文章:

    jquery提交按鈕的代碼07-28

    基于jQuery的固定表格頭部的代碼08-30

    jQuery(js)如何獲取文字寬度(顯示長(zhǎng)度)09-29

    關(guān)jQuery彈出窗口簡(jiǎn)單實(shí)現(xiàn)代碼-javascript編程06-07

    jQuery 源碼分析和Ready函數(shù)06-28

    jQuery中parent()和siblings()的問題10-16

    ppt動(dòng)作按鈕設(shè)置和動(dòng)畫動(dòng)作設(shè)置12-06

    Oracle查詢?cè)恚篠elect語句09-17

    雙屏顯示器如何設(shè)置和設(shè)置技巧02-20

    Oracle數(shù)據(jù)庫SELECT語句10-25

    91久久大香伊蕉在人线_国产综合色产在线观看_欧美亚洲人成网站在线观看_亚洲第一无码精品立川理惠

      亚洲精品视频久久 | 色婷婷综合缴情综合免费观看 | 日韩国产欧美二区手机在线 | 亚洲福利高清久久 | 无遮挡很黄很爽免费国产 | 日本狂喷奶水在线播放212 |