Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7663407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:03:25+00:00 2026-05-31T14:03:25+00:00

i have an infowindow that has an erase entry button, that when clicked, removes

  • 0

i have an infowindow that has an “erase entry” button, that when clicked, removes the marker and closes the info window.
when i click the “erase entry” button, it removes the marker and closes the infowindow just fine, but it also registers another click on map, and i have no idea why, and it’s driving me nuts.

has anyone bumped into this problem before?
i’m quite a noob at javascript, so any suggestions on implementation would be great too. thank.
below’s pseudocode/summary of what i’m doing:

        //global variable to keep track of which was the last marker clicked
        var lastMarkerJustClicked;

        function load(){
            //create the map and everything, add the following listener
            google.maps.event.addListener(map, 'click', function (event) {
                //firebug has been telling me that after i click "erase entry" and my marker is removed and my infowindow closes, i end up here
                makeParticularMarker(event.latLng);
            });
        }

        function makeParticularMarker(marker_parameter) {
            var markerLocation = //do stuff to get the right marker parameter
            var markerWithLocation = new google.maps.Marker({
                position: markerLocation,
                map: map
            }); 
            var html = "<input type='button' value='Erase Entry' onclick=eraseEntry() />"
            var markerWithInfo = createMarkerWithHTML(markerWithLocation, html);
        }

        function createMarkerWithHTML(markerWithLocation, html) {
            var markerWithInfo = google.maps.event.addListener(markerWithLocation, 'click', function () {
                infoWindow.setContent(html);
                infoWindow.open(map, markerWithLocation)
                lastMarkerJustClicked=markerWithLocation;
            });
        }

        function eraseEntry() {
            infoWindow.close()
            lastMarkerJustClicked.setMap(null);
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T14:03:26+00:00Added an answer on May 31, 2026 at 2:03 pm

    i found the answer here: http://groups.google.com/group/google-maps-js-api-v3/browse_thread/thread/221876cc70bea9c6?pli=1

    it has to do with propagation. and you stop it by doing something like this

    function doSomething(e)
    {
        if (!e) var e = window.event;
        e.cancelBubble = true;
        if (e.stopPropagation) e.stopPropagation();
    }
    

    this site gives a better explanation about this: http://www.quirksmode.org/js/events_order.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i have click event that will pop up a info window & marker
I have map with multiple different colors markers with some info window. Everything works
Have a matrix report now that has Position, Hours and Wages for a location
i have a database where each row has lat/long info for goggle maps. each
I have a custom info window over a google map, sometimes these info windows
I have a map that has checkboxes for users to select what they would
I have a Google Map on our site that has a list of markers
I have a forloop that has a call to a function inside of it.
I have a little button on my page that should load a google map.
i have a google map with multiple markers and each has its own infowindow.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.