zoukankan      html  css  js  c++  java
  • jQuery 如何选中多个相同标签的某一个

    <html>
    <head>
    <script type="text/javascript" src='__PUBLIC__/Mobile/default/js/jquery-1.9.1.min.js'></script>
    </head>
    <body>
    <div class="cat1">
    <div class="cat2">
    <a href="" data_id="1">11</a>
    <a href="" data_id="2">11</a>
    <a href="" data_id="3">11</a>
    <a href="" data_id="4">11</a>
    <a href="" data_id="5">11</a>
    <a href="" data_id="6">11</a>
    <a href="" data_id="7">11</a>
    <a href="" data_id="8">11</a>
    <a href="" data_id="9">11</a>
    </div>
    </div>

    <body>
    <script type="text/javascript">
    //var qq = $('.cat2').parents().attr('class');
    //alert(qq);
    $(".cat1").find("a[data_id='1']").css('color','red');
    //find("a[data-id='"+cid+"']")//动态选择时,参数书写像这样

    </script>
    </html>

  • 相关阅读:
    The Tamworth Two chapter 2.4
    USACO Controlling Companies chapter 2.3 已跪
    非递归快排
    链表二路归并
    Money Systems chapter 2.3 dp
    #pragma pack与sizeof union
    快慢指针
    12
    11
    10
  • 原文地址:https://www.cnblogs.com/scjzhong/p/5141216.html
Copyright © 2011-2022 走看看