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 7572577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:57:34+00:00 2026-05-30T15:57:34+00:00

I need to make something happen when any google maps marker is clicked on.

  • 0

I need to make something happen when any google maps marker is clicked on. Im using the demo from this link as a starting point:

http://gmap3.net/examples/tags.html

UPDATE – ive tried the following:

$.each(markers, function(i, marker){
  marker.click(function(){  
     alert('alert');
  });
});

$.each(markers, function(i, marker){
  $(marker).click(function(){  
     alert('alert');
  });
});

UPDATE Ive tried adding this middle section to existing code:

        $.each(markers, function(i, marker){
            marker.setMap( checked ? map : null);

           //added code begins
            $(marker).click(function(){ 
                 alert('dfd');
              });
           //added code ends

        });
  • 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-30T15:57:36+00:00Added an answer on May 30, 2026 at 3:57 pm

    Note that the OP is asking about doing this using the GMAP3 library, which is a jQuery plugin library that adds an API layer on top of the Google Maps layer. it is absolutely correct to say that the Google API is to use google.maps.addListener, but I think that the OP wants something that’s closer to the GMAP3 example using addMarkers, but listening to the click event. With that in mind, I modified the example from GMAP3 and changed the mouseenter event to the click event and got rid of the mouseleave event.

    For those wanting to do further playing, I created a jsFddle of this example.

    Here’s the source:

    <!DOCTYPE HTML>
    <html>
    <head>
        <style>
         #map {
          width: 400px;
          height: 400px;
      }
    </style>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false">  </script>
    <script type="text/javascript" src="http://gmap3.net/js/gmap3-4.1-min.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $('#map').gmap3({
                action: 'init',
                options: {
                    center: [46.578498, 2.457275],
                    zoom: 5
                }
            }, {
                action: 'addMarkers',
                markers: [
                {
                    lat: 48.8620722,
                    lng: 2.352047,
                    data: 'Paris !'},
                    {
                        lat: 46.59433,
                        lng: 0.342236,
                        data: 'Poitiers : great city !'},
                        {
                            lat: 42.704931,
                            lng: 2.894697,
                            data: 'Perpignan ! <br> GO USAP !'}
                            ],
                            marker: {
                                options: {
                                    draggable: false
                                },
                                events: {
                                    click: function(marker, event, data) {
                                        var map = $(this).gmap3('get'),
                                        infowindow = $(this).gmap3({
                                            action: 'get',
                                            name: 'infowindow'
                                        });
                                        if (infowindow) {
                                            infowindow.open(map, marker);
                                            infowindow.setContent(data);
                                        } else {
                                            $(this).gmap3({
                                                action: 'addinfowindow',
                                                anchor: marker,
                                                options: {
                                                    content: data
                                                }
                                            });
                                        }
                                    }
                                }
                            }
                        });
    });​
    </script>
    </head>
    <body>
        <div id="map" style="width: 400x; height: 400px"></div>​
    </body>
    </html>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I need to make something happen when an EditText loses its
I'm writing an application using WPF, and I need to make something that looks
So basically I need to make feature that if you select something from first
I'm playing with GAE, and need to make a query with something like this:
I need to make something like: Type CustomType = Type.GetType(instanceName); It always returns null.
I need to make something(i call it a scheduler) that checks the time of
I need something like make i.e. dependencies + executing shell commands where failing command
SITUATION: I need to make encryption happen between my remote database and my c#
I'm a bit lost on the way to make this happen the fastest. I
I need to make a lot of operations using BigDecimal, and I found having

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.