Custom ID to markers

16 views
Skip to first unread message

Humera Kouser

unread,
Mar 29, 2017, 8:55:05 PM3/29/17
to Google Maps JavaScript API v3
Hi all,

How can I set custom ID to marker in Google Maps?
I tried with many ways, one of the way

I get marker.get() not a function. Please anyone help on this.

Thanks 

Sudip Barman

unread,
Apr 11, 2017, 3:04:20 AM4/11/17
to Google Maps JavaScript API v3
Hello Humera,
While creating the marker you can add more properties in it
e.g.

     var marker = new google.maps.Marker({
          position
: myLatLng,
          map
: map,
          title
: 'Hello World!', customPropertiy: 'ID'
       
});

and you can get this id on getting the marker object.

Thanks,
Sudip Barman
Reply all
Reply to author
Forward
0 new messages