jQuery 动态绑定n多标签使用方法
<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+"']")//动态选择时,参数书写像这样
//动态确定n多标签使用方法
var CAT1 = $(".cat2").find('a');
CAT1.click(function(){
var data_id = $(this).attr("data_id");
alert(data_id);
});
//动态确定n多标签使用方法
</script>
</html>