Good day! I'm new with jQuery. Please how do I loop through buttons to bring out only its contents when I click on it, and change the active class on them each time I click.
I repeated the code below for two more buttons:
$("#member-company-btn").on("click", () => {
$("#member-company-content").show("slow");
$("#group-company-content").hide("slow");
$("#abuja-sub-company-content").hide("slow");
$("#lagos-sub-company-content").hide("slow");
})
$("#group-company-btn").on("click", () => {
$("#member-company-content").hide("slow");
$("#group-company-content").show("slow");
$("#abuja-sub-company-content").hide("slow");
$("#lagos-sub-company-content").hide("slow");
})
This to add active class to only the clicked button didn't work.
$("#subsidiary-btns .subsidiary-btn").on("click", () => {
$("button.subsidiary-btn").removeClass("subsidiary-btn-active");
$(this).addClass("subsidiary-btn-active");
})
Thank you
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.