I have a multi state list which changes when a button (red word) is selected on the left > this changes the words on the right.
When the page loads it automatically loads STRATEGY and the list; how can I code the button strategy to appear as white when page loads? The button changes to white on hover when you start using the list.
This is the current code:
// API Reference: https://www.wix.com/velo/reference/api-overview/introduction
// “Hello, World!” Example: https://learn-code.wix.com/en/article/1-hello-world
$w.onReady(function () {
$w("#button8").onClick(() => {
$w('#statebox8').changeState("State1");
} );
$w("#button7").onClick(() => {
$w('#statebox8').changeState("State2");
} );
$w("#digitalbutt").onClick(() => {
$w('#statebox8').changeState("State3");
} );
$w("#customerbutton").onClick(() => {
$w('#statebox8').changeState("State4");
} );
});
$w("#myElement").style.color="rgba(255,0,0,0.8)"; $w("#myElement").style.color="rgb(255,0,0)"; $w("#myElement").style.color="white";
In your case:
1) First rename all your BUTTON-IDs and do it the right way....
btnStrategy
btnMarketing
btnDigital
btnCustomer
---> "btn" <-- stands for --> BUTTON
$w.onReady(function () { $w("#btnStrategy").onClick(() => { $w("#btnStrategy").style.color="white"; $w('#statebox8').changeState("State1"); }); $w("#btnMarketing").onClick(() => { $w("#btnMarketing").style.color="white"; $w('#statebox8').changeState("State2"); }); $w("#btnDigital").onClick(() => { $w("#btnDigital").style.color="white"; $w('#statebox8').changeState("State3"); }); $w("#btnCustomer").onClick(() => { $w("#btnCustomer").style.color="white"; $w('#statebox8').changeState("State4"); }); });