Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google map Info box doesn't listen the click event

How to attach a click event to a goole map

like image 704
Deepak Lamichhane Avatar asked Dec 13 '25 14:12

Deepak Lamichhane


1 Answers

You need to create marker & add a listener to it.

amarker = new google.maps.Marker(
           { position: alocations,
             map: map,
             title: "title " 
           } );
        google.maps.event.addListener(amarker, 'click', 
            function() {
              markerClick(this);
            }
        );
    }
    function markerClick( mark )
    {
       //do something
    }

You can follow the link for more details http://code.google.com/apis/maps/documentation/javascript/events.html

like image 141
Abdullah Md. Zubair Avatar answered Dec 16 '25 07:12

Abdullah Md. Zubair