Google maps (V3) - Map container selector (using jquery)

I'm trying to solve a tricky problem in Google Maps (api V3)

Works nicely:

var map = new google.maps.Map(document.getElementById("map_container"), myOptions);

Doesn't Work if I try to use a jQuery selector

var map = new google.maps.Map($('#map_container'), myOptions);

I made this EXAMPLE


Thank you in advance

Cheers

Pedro

Answers


It expects a DOM element, but $('#map_container') returns a jQuery object. If you want to use a jQuery selector, do:

var map = new google.maps.Map($('#map_container')[0], myOptions);

Or you can also use .get(0) instead of [0], this returns the actual DOM object.


Need Your Help

JQuery Ajax is sending GET instead of POST

jquery ajax

The following code triggers a GET instead of a POST HTTP request.

C# Export cert in pfx format

pki pfx x509certificate2

NET to export a certificate from the cert store into a PFX file. I'm trying to use the X509certificate2.Export method with the X509ContentType.Pfx flag set, but am unsure how to handle the returned...