title: GeoJson/Mapbox markers: let users change their attributes (e.g. color) via a button [EDITED]
body: <p>(EDIT:I received some thumbs down because accidentally posted the question with an unfinished name, please don't be deterred)</p>
  
  <p>As in the example of <a href="https://www.mapbox.com/mapbox.js/example/v1.0.0/change-marker-color-click/" rel="nofollow">https://www.mapbox.com/mapbox.js/example/v1.0.0/change-marker-color-click/</a> I'm trying to let the user change attributes (in this example the color) of markers. </p>
  
  <p>In this example of Mapbox the attribute of a marker is changed when the user clicks on the marker. However, I would like to change the attribute of markers when the user clicks on one of the divs (buttons) in the html instead. So when the user clicks on Button1 the color of Marker 1 should change and when the user clicks on Button2 the color of Marker 2 should change.</p>
  
  <p>You can find my test html here: <a href="http://weareguide.com/test.html" rel="nofollow">http://weareguide.com/test.html</a></p>
  
  <p>Any help is greatly appreciated.</p>
  
  <pre><code>&lt;!--I would like these buttons to do the job--&gt;
  &lt;div class='buttons'&gt;
      &lt;div id='Button1' onclick='AddToSelection(1)'&gt;Change color Marker 1&lt;/div&gt; &lt;!--call a function that changes Marker 1--&gt;
      &lt;div id='Button2' onclick='AddToSelection(2)'&gt;Change color Marker 2&lt;/div&gt; &lt;!--call a function that changes Marker 2--&gt;
  &lt;/div&gt;
  
  &lt;div id='map'&gt;&lt;/div&gt;
  
  &lt;script&gt;
  var map = L.mapbox.map('map', 'njit.map-cval12af');
  
  var geoJson = [
      {type:'Feature',geometry:{type:'Point',coordinates:[174.7665232,-36.853447]},properties:{title:"Marker 1",'marker-color':'#4c96ce','marker-size':'small'}},
      {type:'Feature',geometry:{type:'Point',coordinates:[174.7774598,-41.29007064]},properties:{title:"Marker 2",'marker-color':'#4c96ce','marker-size':'small'}}
  ];
  
  map.markerLayer.setGeoJSON(geoJson);
  
  //This is the current function used in the Mapbox example, I want to replace this with the new function
  map.markerLayer.on('click',function(e) {
      e.layer.feature.properties['marker-color'] = '#000000';
      map.markerLayer.setGeoJSON(geoJson);
  });
  &lt;/script&gt;
  </code></pre>