简体   繁体   中英

Trigger Google Maps event listener on link clicks

I've a set of points which load on Google Maps and clicking the marker shows the infoWindow. Next, I wanted to show links specific to each point such that when the link is clicked, that specific point's infoWindow is show.

Here's my code:

var points = //array of points;
for(var i = 0; i < points.length; i++) {
    t=new google.maps.Marker({position:latlng});
    google.maps.event.addListener(point[i], 'click', function(event) {
         //infobox.open(map, this);
    }
    show_e.push('<a href="#" id="'+point[i].id+'">'+point[i].name+'</a><br/>');

    //How to attach marker click event to the above link? 



}

I'm not sure what you're looking for but I think this can help you:

JavaScript function in href vs. onclick

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM