I have a product gallery and the side there are some buttons which are the categories of these products (buttons: cabinet, monitors, mouse, chairs, etc.), when I click on this category, a toggle only activates the products of that specific category.
However, I want above these products to contain a title that will initially look like this: "Products" (this is the default), but when I click on the Cabinet category, for example, that title will change to "Cabinets". Did you understand?
Well, I want this to happen with all the other buttons always changing the title at runtime.
I even tried to create a function
when clicking using GetElementById
along with a IF ELSE
, but it applies the first validation only.
Someone who has done something similar could help me?
Important : I am getting the database buttons, I simply made a WHILE
statement that will repeat the buttons according to the number of categories registered in the database, so you have to face it, like adding a different function for each button. It has how, but not so easily.