This example shows you how easily jQuery + jMaps makes adding and removing markers from your map.
Google markers allows you to define and add a marker to any position on the map.
jQuery(document).ready(function(){
jQuery('#map1').jmap('init', {'mapType':G_HYBRID_MAP,'mapCenter':[37.4419, -122.1419]});
jQuery('.add-marker').click(function(){
jQuery('#map1').jmap('AddMarker', {
'pointLatLng': [37.4419, -122.1419],
'pointHTML': '<strong>This was added with jMaps</strong>'
}, function( marker, options){
jQuery('.remove-marker').click(function(){
jQuery('#map1').jmap('RemoveMarker', marker);
});
});
});
});
jQuery(document).ready(function(){
jQuery('.add-marker-2').click(function(){
jQuery('#map2').jmap('AddMarker', {
'pointLatLng': [37.4419, -122.1419],
'pointHTML': '<strong>You can drag me.<br />Double Click Me to Remove Me!</strong>',
'pointIsRemovable':true,
'pointIsDraggable':true
});
return false;
});
});