Question:
I want a box to appear/disappear depending on the value of a boolean in a collection
Product:
Wix Editor
What are you trying to achieve:
I have this code:
import wixData from ‘wix-data’;
$w.onReady(function () {
wixData.query(“Unternehmen”)
.find()
.then(result => {
const gutscheinValue = result.items[0].Gutschein;
if (gutscheinValue === false) {
$w(“#box18”).hide();
} else {
$w(“#box18”).show();
}
})
.catch(error => {
console.error(error);
});
});
and want to use it on this website: Afrim Kerimi (wirtschaft-eichgraben.at)
What my code tries to archieve is make a container (box18) disappear when the boolean “Gutschein” in my Collection “Unternehmen” is false, and make it appear when the value is set to true. Im relatively new to coding and dont really know why this doesnt work.
Any help would be appreciated.
What have you already tried:
Scanveged the forums and google but didnt find anything (although i might have just missed it)
Additional information: