Hello!
I have connected a text to appear and disappear through a Boolean switch, but when the switch is activated the text changes to “true”. I do not want it to say “true”, I want the text to stay the same and not change. Can someone help me with this?
if your code is something like this:
import wixData from 'wix-data';
$w.onReady(function () {
$w("#Dataset").onReady(() => {
let items = $w("#Dataset").getCurrentItem().booleanfield;
if (items === true) {
$w("#text1").show;
}
});
Note: “===true” is not necessary, for it’s a boolean.
Put your code to something like this:
import wixData from 'wix-data';
$w.onReady(function () {
$w("#Dataset").onReady(() => {
let items = $w("#Dataset").getCurrentItem();
if (items["booleanfield"]) { $w("#text1").show(); }
else
$w("#text1").hide();
});