<script> $("ul li:nth-child(n)").click(function(){ $(".id p:nth-child(n)").hide(); $("table tr th:nth-child(n)").hide(); }); </script>
1 回答
www说
TA贡献1775条经验 获得超8个赞
$('ul li').click(function(){ var index = $(this).index() $('.id p').eq(index).hide() $('table tr th').eq(index).hide()}) |
div:nth-child(n) 代表div里面的所有子元素
div:nth-child(2n) 代表div里面的双数元素 0,2,4,6,8,......
div:nth-child(2n+1) 代表div里面的单数元素 1,3,5,7,9,......
添加回答
举报
0/150
提交
取消
