Change Marker Color on Click

Change a marker's color and then change it back
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Change Marker Color on Click</title>
  <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no' />
  <script src='//api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.js'></script>
  <link href='//api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.css' rel='stylesheet' />
  <!--[if lte IE 8]>
    <link href='//api.tiles.mapbox.com/mapbox.js/v1.4.0/mapbox.ie.css' rel='stylesheet'>
  <![endif]-->
  <style>
    body { margin:0; padding:0; }
    #map { position:absolute; top:0; bottom:0; width:100%; }
  </style>
</head>
<body>
<script src="/mapbox.js/assets/leaflet-knn.min.js"></script>
<div id='map'></div>
<script type='text/javascript'>
var map = L.mapbox.map('map', 'examples.map-20v6611k')
    .setView([37.9, -77], 6);

var geoJson = [{
    type: 'Feature',
    geometry: {
        type: 'Point',
        coordinates: [-77, 37.9]
    },
    properties: {
        title: 'Marker One',
        // http://mapbox.com/developers/simplestyle/
        'marker-color': '#CC0033'
    }
},
{
    type: 'Feature',
    geometry: {
        type: 'Point',
        coordinates: [-78, 36.5]
    },
    properties: {
        title: 'Marker Two',
        'marker-color': '#0099ff'
    }
}];

map.markerLayer.setGeoJSON(geoJson);

function resetColors() {
    for (var i = 0; i < geoJson.length; i++) {
        geoJson[i].properties['marker-color'] = geoJson[i].properties['old-color'] ||
            geoJson[i].properties['marker-color'];
    }
    map.markerLayer.setGeoJSON(geoJson);
}

map.markerLayer.on('click',function(e) {
    resetColors();
    e.layer.feature.properties['old-color'] = e.layer.feature.properties['marker-color'];
    e.layer.feature.properties['marker-color'] = '#000';
    map.markerLayer.setGeoJSON(geoJson);
});

map.on('click', resetColors);
</script>
The code and documentation to mapbox.js is hosted on GitHub where you can contribute changes and improvements.