Google Maps API: Cannot set property ‘position’ of undefined

Cannot set property ‘position’ of undefined

If the Google Maps API v3 is returning this error here’s how to fix it.


I’ve used jQuery to get the map container but then it starts returning an error.

map = new google.maps.Map($('#my-map'), mapOptions);


Try using the following code to get the map container:

var mapElem = $("#container").find("#my-map")[0];
map = new google.maps.Map(mapElem, mapOptions);


No comments yet, leave yours!

Leave a Reply

Add <code> Some Code </code> by using this tags.