google maps api v3 uncaught typeError: Cannot read property 'offsetWidth' of null
i've been on your page and i saw this :
<div id="map>
Close the property like that :
<div id="map">
It could fix some problems :)
Ilan Biala
I'm a senior electrical and computer engineering major at Carnegie Mellon University with experience, in systems programming, full-stack development, API design and implementation, and DevOps.
Updated on June 05, 2022Comments
-
Ilan Biala almost 2 years
Im going through a HTML5 book that includes geolocation, which I've been able to figure out. However, the next step is to include a map using the google maps API. I've already gotten an API key and have structured everything just like the book and the google documentation said, but I can't seem to figure out this problem. On line 29 in the main.js file on http://ilanshomekitchen.x10.mx/projects/Geolocation/, there is an: "Uncaught TypeError: Cannot read property 'offsetWidth' of null. I've searched google and so far nothing has worked. I even defined the height and width of the map in the css file on the site.
Any ideas?
-
Ilan Biala almost 12 yearswow that actually worked! Thanks! ....but isn't that invalid html? And shouldn't the initial id declaration work and not be necessary to include both declarataions?
-
PoulsQ almost 12 yearsThe <div id="map> was an invalid HTML Tag, you always have to close properties inside tags ! In fact, the problem was when you tried to find the element with "map" as ID, it didn't exists because the ID of the div was "map > ..." for him :)