Toggle Visbility

Discussion created by shaun_weston-eagle-co-nz-esridist on Nov 7, 2011
Latest reply on Nov 25, 2011 by Xhosa
I think I must be missing something very basic here, but all I want to do is have toggle working for map services. When the checkbox is checked, show the layer and when the checkbox is unchecked, hide the layer. The showing the layer bit works, but the hide does not. I've tried a lot of different methods and the only one that works is removeAllLayers()?

 function visibleDPLayers() {
  var DPlayer = new esri.layers.ArcGISDynamicMapServiceLayer("");
  if (legend.DPCheckbox.checked == true) {
   alert ('show');
  else {
   alert ('hide')