javascript - Remove Markers from Google Maps -
i'm using following code creating markers:
<pre> var marker = new google.maps.marker({ position: sitelatlng, map: map, icon: 'https://maps.google.com/mapfiles/kml/shapes/schools_maps.png', title: value2["title"], zindex: 4, html: value2["content"] }); </pre>
now want remove markers map, created by
<pre> var centermap = new google.maps.latlng(50, 10); var myoptions = { zoom: 4, center: centermap, maptypeid: google.maps.maptypeid.roadmap } var map = new google.maps.map(document.getelementbyid('gmapspreview'), myoptions); </pre>
same problem here:
i've corrected it, change clearmarkers method way:
set_map(null) ---> setmap(null) google.maps.map.prototype.clearmarkers = function() { for(var i=0; < this.markers.length; i++){ this.markers[i].setmap(null); } this.markers = new array(); };
documentation has been updated include details on topic: https://developers.google.com/maps/documentation/javascript/markers#remove
Comments
Post a Comment