I ran into an issue where I couldn't use the jquery selector object to set the map variable. I was forced to fall back to document.getElementById(). It was very odd because jquery had the correct object, the google maps constructor just didn't like it.
On Apr 12, 2:52 am, Macke <[email protected]> wrote: > Hello William! > > I tried to change the code but i still get the same message. I have > used the same code on a ordinary .php file that has nothing to do with > Drupal and then it works. > If i try running the JQuery $('#map_canvas') after the page is loaded > nothing gets selected if i change the code to $('div#map_canvas') on > object get selected. But i still get the same error message when the $ > ('div#map_canvas') is used. > > On 11 Apr, 09:21, William <[email protected]> wrote: > > > > > On Apr 10, 8:32 pm, Macke <[email protected]> wrote: > > > > map = new google.maps.Map(('#map_canvas'), mapOptions); > > > the error is using the jquery # selector without a reference to > > jquery. > > > If you really want to use jquery for this, it would be: > > > map = new google.maps.Map($('#map_canvas')[0], mapOptions); > > > or instead use the usual getElementById function: > > > map = new google.maps.Map(document.getElementById('map_canvas'), > > mapOptions); -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
