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

Brian Pelowski
Brian Pelowski
7,202 Points

Google Maps - Java Script

I can't get this to question. Alter the app.js on line 28 to select the addresses from the parent window

Here is my code:

$("address").each(function(parent.window){
    var $address = $(this);
    geocoder.geocode({address: $address.text()}, function(results, status){
        if(status == google.maps.GeocoderStatus.OK) addMarkerToMap(results[0].geometry.location, $address.html());
    });

4 Answers

James Lister
James Lister
6,569 Points

Hi, I figured this out. $("address", parent.window.document).each(function()

So you need to put it after "address" seperated by a comma

James Lister
James Lister
6,569 Points

I am stuck here too, It does say to pass in "parent.window.document" but not sure how

Brian Pelowski
Brian Pelowski
7,202 Points

Interesting. I was not sure where to pass it in either.i will try what you did, but an explanation would be nice.

Hi, James is correct, however the code you have written is missing { from the end. I was stuck here too and your code above helped greatly but without { it won't accept it. So taking line 28 and replacing it with

$("address", parent.window.document).each(function(){

works perfectly.