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 Build an Interactive Website Google Maps Integration Adding a Dynamic Map

*HELP* Need some advice for the "Adding a Dynamic Made Code Chellenge"

Hey guys,

So I'm stuck on the Adding a Dynamic Map code challenge.

I have been trying to implement the requirements in the <script> tag to no avail.

Am I to add a map id in the CSS section of the HTML or is this purely a JavaScript thing, or am I no where near the ballpark in what I am trying to do? I'm a little confused.

Anyway here is what I have done that of course presents and error.

<script type="text/javascript">
      $("#map").prepend('<div id="map"></div>');
        var mapOptions = {};

        var mapElement;
        var theMap;
</script>

Any help of this would be greatly appreciated.

Thanking you in advance

Stu :)

2 Answers

Chase Lee
Chase Lee
29,275 Points

Your div should go between the first body tag and the first script tag.

<body>
  <div id="map"></div>
    <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAn8fk75K8kCdW6pQ4B7yoBHJNrUbleieY&sensor=false">

Hey Chase,

I think I needed a break, I went back in for another go and actually read the question correctly this time. What a spaz I am :S

Stu :D