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.


Try using the following code to get the map container:

  • Hi Rick,
    Thanks for nice article.

    I’ve tried your code to fix my error. My codes below:

    If I use $(“.container”).find(“#map-canvas”)[0]; the result is undefined. Caused it I remove the index [0] from my code. But I am still getting error:

    Have you ideas about that?

Leave a Reply

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