Change Div style onclick

后端 未结 6 1607
逝去的感伤
逝去的感伤 2021-01-15 14:07

I have 2 tabs at the top of a page. When one tab is clicked, I would like that tab to have an \"active\" class and the other tab to have an \"inactive\" class so that the us

6条回答
  •  爱一瞬间的悲伤
    2021-01-15 14:30

    if using jquery:

    $("div.tabInactive").click(function() {
        $("div.tabInactive").removeClass("tabActive");
        $(this).addClass("tabActive");
    });
    

提交回复
热议问题