Show and hide layers based on radio buttons options
Hello there,
I have thousands of layers here, I want to edit this JavaScript code to make it working well with radio buttons case,
Now when I check on an option, the layer appears (the red circle), and when I click on the same option again, it disappears, (this is perfect when I hava a button to show and hide some insturctions, or hints)
But what I'm looking for in this case, make the layer disappears once I click on the second option or third.. etc, and of course the layer of the second option appears, and so on..
this is the code:
var layers = this.getOCGs();
for(var i=0;i<this.layers.length;i++)
{
if(layers[i].name == "a_1_0")
layers[i].state = !(layers[i].state);
}also I tried to use this code, and give the same result:
var layerName = "a_1_0";
var layers = this.getOCGs();
if (layers!=null && layers.length!=0) {
for (var i in layers) {
if (layers[i].name==layerName) {
layers[i].state = !layers[i].state;
break;
}
}
}


Thank you very much
