最新国产好看的视频,伊人天堂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月)
深州市| 凉山| 荆门市| 依安县| 鹿邑县| 保定市| 小金县| 岑溪市| 涿鹿县| 万载县| 武山县| 基隆市| 辰溪县| 石景山区| 萝北县| 县级市| 陈巴尔虎旗| 金秀| 东丰县| 克东县| 兴隆县| 彩票| 定兴县| 安义县| 台中市| 竹北市| 慈溪市| 新安县| 宁明县| 垦利县| 堆龙德庆县| 大安市| 五原县| 伊宁市| 游戏| 平定县| 合阳县| 米泉市| 平南县| 焉耆| 江城|