Remove Marker - Google Maps Javascript API v3 -


Trying the Thai Maps API I add a trapped marker to remove the markers works great, but delete work Is not any idea why this will not work? thank you in advanced!

  Function Placemarker (Events) {var marker = new google.maps.Marker ({clickable: true, position: event.latLng, map: map}); } Function deleteMarker () {marker.setMap (empty); Marker = null; } Initialize function () {var mapOptions = {zoom: 8, center: home}; Map = new google.maps.Map (document.getElementById ('map-canvas'), map options); Google.maps.event.addListener (map, 'rightclick', placeMarker); Google.maps.event.addListener (Marker, 'Click', Delete Marker); } Google.maps.event.addDomListener (window, 'load', start);   

global variable defined

  var map, marker , Home = new google.maps.LatLng (46.5, 13.5); Error message in the result:  
  Unkit type error: The property '__e3_' for undefined main.js can not be read: 15  < / Pre> 

line

  google.maps.event.addListener (marker, 'click', remove marker);   

marker is still undefined because it is not created and event listener can not be attached to it. This line has to be moved to placeMarker () function:

  function in the place marker (event) {marker = new google.maps.Marker ({clickable: true , position: event.latLng, map: map}); Google.maps.event.addListener (Marker, 'Click', Delete Marker); }   



Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -