I've been struggling with setting up a listener and opening content above a marker lately. When I click on the marker, nothing happens.

I tried approaching this through calling showInfo() from the pset specs, as mentioned in other posts like this and this. I have also tried switching to an info window, but that didn't seem to work well either.

Here's what I did:

var latLng = new google.maps.LatLng(place.latitude, place.longitude);

var marker = new google.maps.Marker({
  position: latLng,
  map: map,
  title: "place.place_name"+ "place.admin_name1"


var content = "hello";

google.maps.event.addListener(marker, 'click', function(){
  showInfo(marker, content);

Thanks for your time!

1 Answer 1


All things being equal, this arr.push(marker) is a problem. The distro code initializes an array called markers; unless you have initialized an array called arr, this line will give an error in the console "ReferenceError: arr is not defined" One marker is created, and the function bails before the listener is instantiated.

  • Thank you very much! I completely missed this after looking at the code for so long.
    – soonthoj
    May 5, 2019 at 8:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .