hello!python!

jquery元素获取

<div class="ms-selection">
<ul class="ms-list" tabindex="-1">
<li class="ms-optgroup-container" id="optgroup-selection--1849172622"><ul class="ms-optgroup">
<li class="ms-optgroup-label" style=""><span>NFC EAST</span></li>
<li id="29072334-selection" class="ms-elem-selection ms-selected" style=""><span>王二小</span></li>
<li id="38873268-selection" class="ms-elem-selection" style="display: none;"><span>马汉山</span></li>
<li class="ms-elem-selection ms-selected" id="-1518976198-selection" style=""><span>Philadelphia Eagles</span></li>
<li class="ms-elem-selection" id="-2136494795-selection" style="display: none;"><span>Washington Redskins</span></li>
</ul>
</div>

读取class=ms-selected的span值

<script type="text/javascript">
        $(function () {
            $(".ms-selected").each(function () {
                alert($(this).find("span").html());
            })
        })
    </script>

 

posted @ 2018-05-31 11:44  你坚持了吗  阅读(137)  评论(0编辑  收藏  举报
hello!python!