Jquery ui 删除jquery删除按钮上的所有GMAP标记
我使用jQueryUIMap进行GMAP,我想在点击GMAP上的地图时弹出窗口Jquery ui 删除jquery删除按钮上的所有GMAP标记,jquery-ui,jquery-gmap,Jquery Ui,Jquery Gmap,我使用jQueryUIMap进行GMAP,我想在点击GMAP上的地图时弹出窗口 $(function() { $('#map_canvas').gmap( {'center': new google.maps.LatLng(-0.789275, 113.921327), 'callback': function(map) { $(map).click( function(event) {
$(function() {
$('#map_canvas').gmap( {'center': new google.maps.LatLng(-0.789275, 113.921327), 'callback': function(map) {
$(map).click( function(event) {
$('#map_canvas').gmap('addMarker', {'position': event.latLng, 'title': '', 'draggable': true, 'bound': false}, function(map, marker) {
$('#test').dialog({'modal':true, 'title': 'Edit and save point', 'buttons': {
"Remove": function() {
$(this).dialog( "close" );
$(map).setMap(null);
},
"Save": function() {
$(this).dialog( "close" );
}
}});
findLocation(marker.getPosition(), marker);
}).dragend( function(event) {
var self = this;
findLocation(event.latLng, this);
}).click( function() {
openDialog(this);
})
});
}});
单击此代码中的“删除”按钮时,我想删除所有标记:
"Remove": function() {
$(this).dialog( "close" );
$(map).setMap(null);}
但是记号笔还留着,请有人帮帮我。谢谢之前没有使用过该插件,但快速浏览一下API文档似乎表明这可能有效:
"Remove": function() {
$(this).dialog( "close" );
$(map).clearMarkers();
}
你应该打电话
$('#map_canvas').gmap('clearMarkers');
在插件版本3中,应使用:
$('#map_canvas').gmap('clear', 'markers');
Np,我写了插件,所以我应该知道:)。请随时接受答案:)当我调用此代码时,我得到“uncaughttypeerror:无法读取未定义”的属性“apply”,知道为什么吗?