Get google.maps.Map instance from a HTMLElement

You can’t get google.maps.Map object from DOM Element ,on which Google Maps object have been constructed. google.maps.Map is just a wrapper, which controls DOM Element for viewing the map, and that element does not have reference to its wrapper.

If your problem is only the scope, make map as a property of window object, and it will be accessible from everywhere in your page. You can make 'map' as global by using one of these:

 window.map = new google.maps.Map(..) 

or

 map = new google.maps.Map(...) //AVOID 'var' 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)