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>

你可能感兴趣的:(jQuery 如何选中多个相同标签的某一个)