Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a reference to google Map object from the id of the container?

Is possible to get a reference to the google.maps.Map object for a given DOM element?

like image 820
Enrique Avatar asked Dec 16 '11 00:12

Enrique


1 Answers

No, it's not possible to get an already instantiated map given a DOM element.

I usually work around in one of two ways, created a global map variable or passing the map variable around between functions as needed. If you're working with multiple maps on a page, you could probably create your own map registry that handled simple DOM id -> map variable lookups.

like image 87
bamnet Avatar answered Oct 13 '22 20:10

bamnet