Toblerone
Posts: 0
Joined: Wed Aug 07, 2013 5:08 pm

add marker to map not working?

I'm trying to add a marker to a map, I've followed several examples on here but every time I try to add it I get this error

Uncaught Error: Invalid value for property <map>: [object HTMLDivElement]

Which occurs in this line

var barMarker = new google.maps.Marker({
position:location2,
map:map,
title:"Murphy's Bar"
});

now i've tried defining the map variable in sevral ways but each time it's the same

//var map = Appery('multiGoogleMap').get(0);
//var map = $('div[name="multiGoogleMap"]')[0];
//var map = $('div[name="multiGoogleMap"]');
//var map = $('div[dsid="multiGoogleMap"]').get(0);
//var map = $('div[dsid="multiGoogleMap"]');

but each one gives the same error, does anyone have an idea? (and yes, the map name is multiGoogleMap, I checked that first :P).

Toblerone
Posts: 0
Joined: Wed Aug 07, 2013 5:08 pm

add marker to map not working?

Getting somewhere now, if i set map var like this

var map = new google.maps.Map(document.getElementsByName("multiGoogleMap")[0], Appery('multiGoogleMap').options);

or

var map = new google.maps.Map(document.getElementsByName("multiGoogleMap")[0], {zoom:10});

Then the code works

HOWEVER

the map doesnt display, just get a grey screen, no errors, nothing, tried on web + device. I've called map.refresh(); after setting marker too.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

add marker to map not working?

Hello! Try this codevar map = Appery('multiGoogleMap')&#46;gmap;/code

Return to “Issues”