Page 1 of 1

add marker to map not working?

Posted: Fri Aug 30, 2013 7:57 am
by Toblerone

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).


add marker to map not working?

Posted: Fri Aug 30, 2013 8:18 am
by Toblerone

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.


add marker to map not working?

Posted: Fri Aug 30, 2013 10:40 am
by Maryna Brodina

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