Change Google Maps Marker Icon When Clicking On Other
Answer : What duncan said: What you want to do is add all your markers to an array. In your click event handler, loop over that array, updating each marker's icon. Then finally set the icon for just the marker that's been clicked. google.maps.event.addListener(marker, 'click', (function (marker, i) { return function () { infowindow.setContent(locations[i][0], locations[i][6]); infowindow.open(map, marker); for (var j = 0; j < markers.length; j++) { markers[j].setIcon("https://cdn3.iconfinder.com/data/icons/musthave/24/Stock%20Index%20Up.png"); } marker.setIcon("https://cdn3.iconfinder.com/data/icons/musthave/24/Stock%20Index%20Down.png"); }; working fiddle working code snippet: var markers = []; var map; function initialize() { map = new google.maps.Map(document.getElementById('map'), { zoom: 12, // center: new google.maps.LatLng(-33.92, 151.25), center: new google.maps.LatLng(36.8857, -7...