title: Mapbox toggle visibility of multiple layers
body: <p>I'm trying to toggle the visibility of a layer in a Leaflet/Mapbox map with this function:</p>
  
  <pre><code>var showOne = document.getElementById("one");
  
  showOne.onclick = function(e) {
      if (this.className='active') {
          map.removeLayer(groupOne);
          this.className = '';
      } else {
          map.addLayer(groupOne);
          this.className = 'active';
      }
  };
  </code></pre>
  
  <p>That toggles one layer off but not back on. How can I toggle the layer back to visible? Then, how can I toggle multiple layers -- will this work:</p>
  
  <pre><code>var showOne = document.getElementById("one");
  
  showOne.onclick = function(e) {
      if (this.className='active') {
          map.removeLayer(groupOne);
          map.removeLayer(groupTwo);
          this.className = '';
      } else ...
  </code></pre>
  
  <p><a href="http://jsfiddle.net/nathanbweb/Q3hfP/" rel="nofollow"><strong>fiddle</strong></a></p>