Adding text labels to markers in Google maps, API V3

If you start working with the Google maps API, one of the first things you might want to do is to add a marker or custom icon to the map at a specific location. This is easy enough to do and you can have a look at this example on how to do it. But what if you want to add text or a label to one of your markers that always shows up on the map, not only when you hover over the marker? Strangely enough, this isn’t as easy as you would think…

Luckily Marc Ridey wrote a very helpful article with example code (for API V3) on how to easily add labels to the markers on your Google map. You might need to customize it a bit to suite your specific needs, but it will surely save you loads of time.

Hope this helps somebody. :)

Enjoy!

4 Responses to “Adding text labels to markers in Google maps, API V3”

  1. Simão says:

    Cool :)

    I wonder when google will give the option to attribute a label to the marker, like in static maps (like here)

    • Gerrit says:

      Hi Simão! Thanks for your comment. I’m sure Google will continue to develop the APIs for the different map applications and hopefully in the near future we would be able to add labels very easily and with nice customization options too! I’m glad you found the post helpful. :)

  2. Eric says:

    Man, you just saved me a hundred hours! This works perfectly. Instead of appending a span to the div, I am appending a div to the div so that I can style it with an image of the place I’m marking and 3 pieces of text data about the place. Took me about 5 minutes to adjust your code. Thank you so much!!

  3. Bob says:

    This works great! Thank you very much!

Leave a Reply to Simão