Reputation: 372
I'm trying to make code which will put icon on Google Map and ID(HTML ID). I do little code for test, I get alert message but icon doesn't hide. Why?
var _hSync_ikona_dolara = new google.maps.Marker({
position: SanMap.getLatLngFromPos(1320.7709, -891.5645),
map: map,
icon: '_hsync_style/_hsync_images/_hsync_map_icons/_hsync_map_dollar.gif',
id: 'testid' // THIS!
});
$('#_test').click(function()
{
alert("e");
$('#testid').hide();
});
So, when user click on _test
ID(text, button whatever...), all icons with id testid
should hide.
EDIT: I found this
var _hSync_ikona_dolara = new google.maps.Marker({
position: SanMap.getLatLngFromPos(1320.7709, -891.5645),
map: map,
icon: '_hsync_style/_hsync_images/_hsync_map_icons/_hsync_map_dollar.gif'
});
_hSync_ikona_dolara.metadata = { id: 'testid' };
It doesn't work, question was posted six years ago.
Upvotes: 1
Views: 319
Reputation: 734
Consider reading through the docs where it goes through setting event listeners, as this will help you trigger other functionality with markers.
https://developers.google.com/maps/documentation/javascript/examples/event-simple
Upvotes: 1