title: Filtering mapbox markcluster
body: <p>I am trying to filter mapbox markers with custom icons in a markerclustergroup. I can't seem to get the filters working on the markerclustergroup. Here is the relevant part of the code:</p>
  
  <pre><code>var filters = document.getElementById(‘filters’);
  var checkboxes = document.getElementsByClassName(‘filter’);
  
  var markers = L.mapbox.featureLayer()
     .setGeoJSON(geojson);
  
  var markercluster = new L.MarkerClusterGroup();
  
  markers.on(‘layeradd’, function(e) {
  
  // Create custom markers
  
     var marker = e.layer,
     feature = marker.feature;
     marker.setIcon(L.icon(feature.properties.icon));
  
   function change() {
   // Find all checkboxes that are checked and build a list of their values
      var on = [];
      for (var i = 0; i &lt; checkboxes.length; i++) {
          if (checkboxes[i].checked) on.push(checkboxes[i].value);
      }
      // The filter function takes a GeoJSON feature object
      // and returns true to show it or false to hide it.
      markers.setFilter(function (f) {
          // check each marker’s symbol to see if its value is in the list
          // of symbols that should be on, stored in the ‘on’ array
          return on.indexOf(f.properties[‘marker-symbol’]) !== -1;
      });
      return false;
  }
  
  // When the form is touched, re-filter markers
  filters.onchange = change;
  // Initially filter the markers
  change();
  
   markercluster.addLayer(markers);
   map.addLayer(markercluster);
  </code></pre>