In this short article I will explain how to remove specific / single / selected marker on Button click in Google Maps V3.
Following is the HTML Markup containing the Google Map implementation. To add markers you will need to click on the map. These markers are added to a JavaScript array. Each marker is assigned a unique ID so that it can be identified and then removed from the Map.
Note: To know more about please refer my article Google Maps V3: Add (Create) markers on click of Google Maps.
Inside the Info Window of the marker, there’s an HTML button (Delete) which when clicked triggers the DeleteMarker JavaScript function.
This function accepts the ID of the marker as a parameter and using this ID the selected marker is removed from the Map.
<html xmlns="">
<script type="text/javascript" src=""></script>
<script type="text/javascript">
    var markers = [];
    var uniqueId = 1;
    window.onload = function () {
        var mapOptions = {
            center: new google.maps.LatLng(21.0000, 78.0000),
            zoom: 5,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        var map = new google.maps.Map(document.getElementById("dvMap"), mapOptions);
        //Attach click event handler to the map.
        google.maps.event.addListener(map, 'click', function (e) {
            //Determine the location where the user has clicked.
            var location = e.latLng;
            //Create a marker and placed it on the map.
            var marker = new google.maps.Marker({
                position: location,
                map: map
            //Set unique id
   = uniqueId;
            //Attach click event handler to the marker.
            google.maps.event.addListener(marker, "click", function (e) {
                var content = 'Latitude: ' + + '<br />Longitude: ' + location.lng();
                content += "<br /><input type = 'button' va;ue = 'Delete' onclick = 'DeleteMarker(" + + ");' value = 'Delete' />";
                var infoWindow = new google.maps.InfoWindow({
                    content: content
      , marker);
            //Add marker to the array.
    function DeleteMarker(id) {
        //Find and remove the marker from the Array
        for (var i = 0; i < markers.length; i++) {
            if (markers[i].id == id) {
                //Remove the marker from Map                  
                //Remove the marker from array.
                markers.splice(i, 1);
<div id="dvMap" style="width: 500px; height: 500px">
<br />
<input type="button" value="Delete" onclick="DeleteMarkers()" />
Google Maps V3: Remove specific marker - Remove single marker - Remove selected marker