Hey,
I have been playing with some placeholder text and was wondering if you can use the || to check if, in this example ‘courseCat’ can check more than one text query, the first example makes the placeholder text “Need boots” set for any course, regardless if it’s not winter related.
The set placeholder is shown in the photo
function placementText () {
if (courseCat === "Winter Skills" || "Winter Mountaineering" || "Winter Climbing"){
$w('#additionalInfoOne').placeholder = "Need boots?"
$w('#additionalInfoTwo').placeholder = "Need boots?"
console.log(courseCat)
}
else {
$w('#additionalInfoOne').placeholder = "If relevant please inform us of any food allergies"
$w('#additionalInfoTwo').placeholder = "If relevant please inform us of any food allergies"
}
}
This example works but I have 8 text inputs and the code is really long, just thought I would check if i’m missing something simple in the above code.
function placementText () {
if (courseCat === "Winter Skills"){
$w('#additionalInfoOne').placeholder = "Need boots?"
$w('#additionalInfoTwo').placeholder = "Need boots?"
console.log(courseCat)
}
else if(courseCat === "Winter Mountaineering") {
$w('#additionalInfoOne').placeholder = "Need boots?"
$w('#additionalInfoTwo').placeholder = "Need boots?"
}
else if(courseCat === "Winter Climbing") {
$w('#additionalInfoOne').placeholder = "Need boots?"
$w('#additionalInfoTwo').placeholder = "Need boots?"
}
}
Thank you!