首页 > Web开发 > 详细

jQuery 如何选中多个相同标签的某一个

时间:2016-01-19 10:16:48      阅读:136      评论:0      收藏:0      [点我收藏+]

<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 如何选中多个相同标签的某一个

原文:http://www.cnblogs.com/scjzhong/p/5141216.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!