在我的应用程序中,用户在按地图点击时创建标记。所以这样的代码:
function placeMarker(map, location) {
var marker = new google.maps.Marker({
position: location,
map: map
//other...
var infowindow = new google.maps.InfoWindow({
content: ballon.get(0)
});
ballon.find("#delete-btn").click(function(){
infowindow.close();
$mapPreview.data("markers")[id].marker.setMap(null);
delete $this.data("markers")[id];
});
});
"#delete-btn"
在里面infowindow
。问题是当用户单击时,"#delete-btn"
他还会在地图上创建新标记。我怎样才能避免这种情况?