jQuery - Add active class and remove active from other element on click

前端 未结 6 2237
独厮守ぢ
独厮守ぢ 2020-12-14 09:24

I\'m new to jQuery, so I\'m sorry if this is a silly question. But I\'ve been looking through Stack Overflow and I can find things that half work, I just can\'t get it to f

6条回答
  •  没有蜡笔的小新
    2020-12-14 09:54

    Try this one:

    $(document).ready(function() {
        $(".tab").click(function () {
            $("this").addClass("active").siblings().removeClass("active");   
        });
    });
    

提交回复
热议问题