最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

:selected Selector

selected selector

version added: 1.0jQuery(':selected')

描述: 選擇所有被選中的元素。

:selected 選擇器為<option>元素工作。它不適用復(fù)選框和單選框,復(fù)選框和單選框請(qǐng)使用:checked。

Example:

Attaches a change event to the select that gets the text for each selected option and writes them in the div. It then triggers the event for the initial text draw.

<!DOCTYPE html>
<html>
<head>
  <style>
  div { color:red; }
  </style>
  <script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
  <select name="garden" multiple="multiple">

    <option>Flowers</option>
    <option selected="selected">Shrubs</option>
    <option>Trees</option>
    <option selected="selected">Bushes</option>

    <option>Grass</option>
    <option>Dirt</option>
  </select>
  <div></div>
<script>

    $("select").change(function () {
          var str = "";
          $("select option:selected").each(function () {
                str += $(this).text() + " ";
              });
          $("div").text(str);
        })
        .trigger('change');
</script>

</body>
</html>

Demo:

jQuery 1.6 API 中文版腳本之家整理、修訂 (2011年6月)
侯马市| 蚌埠市| 阿坝县| 新民市| 凌源市| 西和县| 革吉县| 莱阳市| 东丰县| 天水市| 东阿县| 镇原县| 布拖县| 庄浪县| 公主岭市| 鄂尔多斯市| 玉田县| 隆尧县| 织金县| 通山县| 定州市| 宁明县| 中山市| 永修县| 丁青县| 陇南市| 鹿邑县| 石嘴山市| 临潭县| 塘沽区| 永济市| 陈巴尔虎旗| 永泰县| 乌恰县| 益阳市| 龙川县| 漯河市| 冷水江市| 涟水县| 虎林市| 广汉市|