0

Print off the var map

  var map = new google.maps.Map(document.getElementById(el), settings);
  console.log(map);

the output is

Ri {gm_accessors_: Object, zoom: 15, gm_bindings_: Object, center: Q, disableDefaultUI: true…}
Ab: Wh
D: W
De: rg
Fc: rg
I: W
Ja: yg
N: W
Re: rg
Se: rg
__e3_: Object
b: div#map
center: Q
controls: Array[14]
d: Qi
disableDefaultUI: true
e: W
features: W
gm_accessors_: Object
gm_bindings_: Object
keyboardShortcuts: false
l: rg
mapDataProviders: "Map data ©2013 Google"
mapTypeId: "roadmap"
mapTypes: Gg
mapUrl: "http://maps.google.com/maps?ll=48.89376,2.33742&z=15&t=m&hl=en-US&mapclient=apiv3"
overlayMapTypes: yg
streetView: Qi
tilt: 0
tosUrl: "http://www.google.com/intl/en-US_US/help/terms_maps.html"
wc: yg
zoom: 15
zoomControl: true
__proto__: c

I just wanted to get this div ID value b: div#map. console.log(map.b) doesn't print div#map is my syntax incorrect?

0

1 Answer 1

1

Chrome (or whatever browser you're using) is probably providing a condensed representation of the object at the point that you log map. My guess is that map.b is returning the DOM element itself, but I can't tell unless you share what console.log(map.b) is returning. If it is returning a DOM element that has an ID, then you could just call map.b.id to get what you're looking for.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.