title: Giving map markers a unique ID then accessing outside of the canvas
body: <p>I have created an array of markers on a map. And I have a list of these markers outside of the canvas. I would like to learn about and create some interaction between these.</p>
  
  <p>My markers are created like so:</p>
  
  <pre><code>var markers = [];
  var marker = [];
  var i;  
  
  // var places is an array of locations
  for (var i=0;i&lt;places.length;i++) {
  
          var place = places[i];
          var latLng = new google.maps.LatLng(place[1], place[2]);
  
           marker[i] = new google.maps.Marker({
              position: new google.maps.LatLng(place[1], place[2]),map: map
          });
  
          marker[i].set('id','marker_'+i);
  
          markers.push(marker[i]);
  
  }
  </code></pre>
  
  <p>I thought perhaps by using <a href="https://developers.google.com/maps/documentation/javascript/reference#MVCObject" rel="nofollow">MVCObject</a> I could set the id of the marker, and perhaps my marker would have an id of 'marker_1' for example, which I could access in the DOM with jquery via something like:</p>
  
  <pre><code>$('#marker_0').doSomething();
  </code></pre>
  
  <p>But this doesn't seem to be the case. </p>
  
  <p>How can I give each marker a unique Id to access in the DOM outside the map canvas and API?</p>