user946101
user946101

Reputation: 1

How to add Class or ID to Overlay in Google Maps API

How can I add a class or ID to an Overlay in the Google Maps API? Example:

subOverlay.prototype.onAdd = function() {
    var div = document.createElement('DIV');
    div.addClass="map_marker";   // I try
    this.div_ = div;
    var panes = this.getPanes();
    panes.overlayImage.appendChild(div);
}

But not working :( Please help me

Upvotes: 0

Views: 1024

Answers (1)

James Allardice
James Allardice

Reputation: 165951

You have got the wrong property. It's className, not addClass:

div.className = "map_marker";

You may have been thinking of the jQuery method, addClass, in which case you would need to call the method, rather than assigning to it.

Upvotes: 1

Related Questions