I can't figure out what I'm doing wrong. I believe everything is written correctly:
The HTML code I have looks like this:
<b> Select Area</b>
<select id="mySelect_1" onchange="showSelectedArea();" >
<option selected disabled hidden value=''></option>"
<option value="1">Center</option>
<option value="2">New jersey</option>
</select>
and the Javascript is as follows:
layer1.setVisibility(false);
layer2.setVisibility(false);
layer3.setVisibility(false);
layer4.setVisibility(false);
}
function showSelectedArea() {
var e = document.getElementById("mySelect_1");
var valueEpilogi_1 = e.options[e.selectedIndex].value;
if (valueEpilogi_1 == "1") {
layer3.setVisibility(true);
}
}
I don't think the issue lies in the if statement or passing the value, even setting true == true doesn't change visibility to true. It seems like there might be an issue with triggering the function at the select tag.
Could someone please review my external js file and let me know what the problem might be? I've defined all layers in the init function which runs on body load - could that be causing the problem? snk.to/f-cdh90xd4