or
marker...">

Setting div attributes google map api v3

I am trying to set google map attributes <div id="myMarker">

or <div class="myClass">

markers so I can subsequently apply CSS formatting to them.

I understand that the class google.maps.Marker

is an extension MVCObject

, so I use for example:

var marker = new google.maps.Marker(markerOptions);
marker.set('id', 'myMarker');
console.log(marker.get('id');

      

It's okay that the property ID is set as shown in the console log. In fact, I don't even need to use it .set()

, I can write it directly to markerOptions

. Anyway, when I do the validation of the div, I see that the property I have set, in this case id="myMarker"

, is not showing up in the markup of the marker as I intended. In other words, it does marker

have a named property key id

whose value is myMarker

, but it is not the one <div id="myMarker">

I intend to create for the subsequent css formatting.

I've seen that each marker belongs to an element that is usually referenced by the title attribute. I'm wondering if there is an easier way to do this (like a class or an id).

So, I'm stuck with this as a similar question in SO indicates what .set(key,value)

works. Indeed, it works for setting a property, but that property, however, is not inserted as html markup for later linking and formatting. Any light rooms would be most helpful. Regards.

+3


source to share





All Articles