$(".test li").click(function() { var _index = $(this).index();
$('.test li' + ":eq(" + _index + ")").addClass('on')
});//我想點擊01 所有01都需要加上on//代碼需要如何修改 謝謝//解決方案$('.test .bd .item:first-child').show();$(".test li").click(function() { var _index = $(this).index() + 1; var textLi = '.test li'; $('.test li' + ":nth-child(" + _index + ")").addClass('on').siblings().removeClass('on'); $('.test .bd .item' + ":nth-child(" + _index + ")").show().siblings().hide();});
jq tab切換問題?
三國紛爭
2018-08-10 09:10:40