Search code examples
javascriptgoogle-mapsgoogle-maps-api-3infowindow

Adding an id to an infowindow (google maps API)


I have a map with infowindows. In my code, I open infowindows and I want to add events, like divs, on this infowindows.

What I would like to now it's if it is possible to add an id to an infowindow (google.maps.InfoWindow({});) with javascript google's maps api 3.

I declare the infowindows like this:

var infowindow = new google.maps.InfoWindow({});
infowindow.setContent(
   '<p>TEST Stack overflow</p>'
   );

Solution

  • Why don't you add an id to the tags which you are creating and then access them that way?

    Look at the google example which references a string.

    Google shows an example of the way in which they declare info windows