i need help about velo
$w.onReady(function() {
$w(“#switch1”).onChange(function () {
if ($w(‘#switch1’).value) {
$w(“#box1”).show();
} else { $w(“#box1”).hide(); }
let loc = $w("#switch1").value;
let cuis = $w("#box1").value;
local.setItem("switch1", loc);
local.setItem("box1", cuis);
})
$w.onReady(() => {
let locat = local.getItem("switch1");
let cuisin = local.getItem("box1");
$w("#switch1").value = locat;
$w("#box1").value = cuisin;
});
});
I have such a code but $w(“#switch1”).value = locat; It gives an error in this part (value) I also used the checked tag, the error is not fixed, please help.
If you’re asking where to use this: I have a switch button, when I click the button, the button pops up (it becomes active) and remains saved even if the page is refreshed. By the way, if you are asking how box1 accepted the value: I used input instead of box. I also renamed it to box1.