Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

'google.maps.event.addListener()' with 'marker', 'click' and an anonymous function. 3/3

Customizing google maps 3/3 http://codepen.io/AcesUp/pen/spnrl

4 Answers

Hello Stephen.

It's possible that the page wasn't fully loaded when the script was executed. If that's the case, try one of these:

  • window.onload = function() { }
  • jQuery $(document).ready(function(){ })
  • put the script tag below your content, right above the closing body tag

I know this is an old question but I hope this helps in case you haven't found a solution.

Hello Victor, thanks for your help. I was able to pass that stage but this will help when I go back for better clarity, so thanks again for your help!

I' edited the question as I'm on the Interactive website project and having an issue with Customizing google maps. the code goes something like this

   var infoWindow = new google.maps.InfoWindow({ content : "Magic Kingdom"})
  google.maps.event.addListener(marker, "click", function(){
  infoWindow.open(map, marker);      //this line is not passing
  })

You're welcome.

I haven't worked with Google Maps yet, I will check that stuff in the next days though. If I know something about your issue, I'll let you know!

Hey cool! If I can help you let me know.

here's the codepen I created http://codepen.io/AcesUp/pen/spnrl