• 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>

  • 相关阅读:
    ios 封装sqllite3接口
    ios7与ios6UI风格区别
    C/C++面试题
    单链表反转
    字符串倒序输出
    简单选择排序
    插入排序
    冒泡
    快速排序
    C++ new delete(二)
  • 原文地址:https://www.cnblogs.com/scjzhong/p/5141216.html
Copyright © 2020-2023  润新知