I want to make a button at the time of clicking keep the color of the selection until I click on
help me please!
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
It's an old thread that has been answered. I'm closing it. If any one has further questions, please open a new post.
Perfect, many thanks!
Thanks for fast reply! With the function below my text is white on load with white background. However, I would like the text to be black on load and only get white on "click". Is it possible? thanks again.
function setButtonColor(button, opacity){ button.style.backgroundColor = `rgba(0,0,0,${opacity})`; button.style.borderColor = `rgba(0,0,0,${(opacity + 1) % 2})`; button.style.color = "rgba(255,255,255,1)";} $w.onReady(function () { let buttonsToChange = [$w("#button1"), $w("#button2")];//put the relevant buttons here buttonsToChange.forEach(button => { setButtonColor(button, 0); button.onClick((event) => { buttonsToChange.forEach(b => { setButtonColor(b, 0); }); setButtonColor(button, 1); }) }) })
Is it possible to switch the color of the text inside the button on click and not just the button color?
Do you mean to keep the color until you click it again or until you click another button?