2016-05-12 8 views
1

Ich versuche Code zu machen, der ein Icon auf Google Map und ID (HTML ID) setzt. Ich tue wenig Code für den Test, ich bekomme eine Warnmeldung, aber das Symbol versteckt sich nicht. Warum?ID-Attribut mit Googles Map API setzen

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(); 
}); 

Also, wenn Benutzer klicken Sie auf _test ID (Text, Button, was auch immer ...), alle Symbole mit id testid verstecken sollte.

EDIT: Ich fand diese

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' }; 

Es funktioniert nicht, wurde Frage vor sechs Jahren geschrieben.

+0

Weiß jemand, wie man es macht? – SilvioCro

Antwort