function changetab(obj){ var div = $(obj).parent("h3").next("div"); div.css("display","block"); div.addClass("active"); if(div.attr("id") == "tab-01"){ $("#tab-02").removeClass("active"); $("#tab-02").css("display","none"); } if(div.attr("id") == "tab-02"){ $("#tab-01").removeClass("active"); $("#tab-01").css("display","none"); } }