Push all the overlays in an array when created (as usual). Following code will clear both map and the array:
while(overlays[0]){
overlays.pop().setMap(null);
}
pop() method of an array removes the last element of an array, and returns that element. 'while' keeps that happening as long as there are elements in the array. When overlays[0] does not exist anymore, the mission is completed and code will proceed.
Applied in the example of the previous post.
thanks for your trick
ReplyDeleteAny suggestions on how to delete just one marker of many in v3 via a link in infowindow? I keep track by pushing marker into markers array, but can't seem to find the "index number" of the one I want to delete
ReplyDeleteThanks
awesome! thanks
ReplyDeleteThank-you sir! This saved me a lot of strenuous, tedious and downright useless coding and searching.
ReplyDeleteThanks!!!
ReplyDelete