One possible solution with mouse event target:
google.maps.event.addDomListener(unitControlDiv, 'click', function(evt) {
$('.unitContainer').children('span').each(function () {
$(this).css('color', 'white');
});
//$(this).css('color', 'black');
evt.target.setAttribute('style', 'color: black');
});
Example at jsfiddle.
Update: Change of attribute could be localized using, for example:
var innerText = evt.target.innerText;
if (innerText == 'mi' || innerText == 'km' || innerText == 'ft') {
evt.target.setAttribute('style', 'color: black');
}