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

General Discussion

Adding a Dynamic Map - Code Challenge 7/7

I am getting an error saying "Oops! It looks like Task 2 is no longer passing." thing is I think the code is ok, can't spot anything wrong can you? I also checked the forum and found 2 other posts that look to confirm I have the correct code so no idea, must be something tiny I am missing.

<code>

<script type="text/javascript">
    var mapOptions = {
    center: new google.maps.LatLng(28.42, -81.58),
    zoom: 18,
    mapTypeId: google.maps.MapTypeId.SATELLITE
    };

    var mapElement = document.getElementById("map");
    var theMap = new google.maps.Map(mapElement, mapOptions);
</script>

3 Answers

OK never mind the solution it seems was to just restart the whole code challenge and enter in exactly what I have put above and this time it worked, I have no idea why it failed the 1st time as I changed nothing, oh well.

I'm getting the same issue. Code is:

 <div id="map">
    <script type="text/javascript"
  src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAn8fk75K8kCdW6pQ4B7yoBHJNrUbleieY&   sensor=false"></script>
  <script type="text/javascript">
       var mapOptions = {
    center: new google.maps.LatLng(28.42, -81.58), 
    zoom: 18,
    mapTypeId: google.maps.MapTypeId.SATELLITE,
  };

   var mapElement = document.getElementById("map");
   var theMap = new google.maps.Map (mapElement, mapOptions);
  </script>
  </div>

and the error I'm receiving is task 2 (the api key insert) is no longer passing.

Can anyone tell me what's up? this is third time through I can't complete the challenge with that code.

i finally figured out it was the div we opened but never closed <div id ="map"></div> two days of frustration.

playing around with it some more, removing (mapElement) allows task 2 to still be correct but nulls out task 7.

help.