I am trying to code my site but I keep getting a "TypeError: $w(...).hide is not a function" error. Can anyone spot what I am doing wrong? I have a bunch of #html in sepquence that I am trying to hide based on a dropdown selection. I am trying to convert:
$w("#htmlLD1").hide(); $w("#htmlLD2").hide(); $w("#htmlLD3").hide();
$w("#htmlLD4").hide();
Into:
let myArray = ["1", "2", "3", "4"];
for(let i = 1; i < myArray.length; i++){
let htmlstr = "\"#htmlLD"+ i + "\"";
console.log(htmlstr)
$w(htmlstr).hide();
}
I knew it was something simple. Thanks!
let htmlstr = `#htmlLD${i}`;