87,901
社区成员
发帖
与我相关
我的任务
分享
$(function() {
$("ul li").bind("click",function() {
$(this).addClass("selected").siblings().removeClass("selected");
});
});
$("#getcolor li").click(function(){
$(this).children("a").addClass("class1").parent().siblings().find("a").removeClass("class1");
});
<script type="text/javascript">
//点击当前的a添加on类,并给其他a清除类名
$("#getcolor li a").click(function(){
$(this).addClass("on").parent().siblings().find("a").removeAttr("class");
})
</script>