I would like to change and maintain the background color for each of the buttons when clicked, so that the user can easily see what filter he activated browsing the books on that page.
I already found the code from @J.D. in a closed thread and applied it:
$w.onReady(function () {
let buttonsToChange = [$w("#alle"), $w("#beziehungen"), $w("#business"), $w("#bewusstsein"), $w("#selbsterkenntnis"), $w("#psychologie"), $w("#geschichten")];//put the relevant buttons here
buttonsToChange.forEach(button => {
setButtonColor(button, 1);
button.onClick((event) => {
buttonsToChange.forEach(b => {
setButtonColor(b, 0);
});
setButtonColor(button, 1);
})Wues
The problem:
-
it is only working for the business button - how to make the others work too?
-
the business button is already white when loading the page. How can I set the #alle button to appear white up front
Would be so happy if someone or J.D. could help me with this, since I am really stuck on this one
Thank you so much!