Onclick on Marker in the Maps API

0

Hello, how do I execute onclick on a marker of maps?

My code is this:

    var marker = new google.maps.Marker({
    position: myLatLng,
    map: map,
    icon: andando,
    shape: shape,
    title: beach[0],
    html: beach[5],
    zIndex: beach[3]
});

In the onclick I need to open a popUp and pass a value to the popup, the value I am getting on the beach [5].

    
asked by anonymous 08.09.2017 / 19:32

1 answer

2

Involving you already know how to create popups. Add the event like this and use the variable marker.html :

marker.addListener('click', function() {
    /* Aqui você utiliza a variável marker.html */
});

See the documentation for GoogleMaps ;

    
08.09.2017 / 19:45