javascript - Adding onclick to Polygon Location Label in Google Maps v3 -
i have following code initialize polygon onclick listener displays alert:
polygon.location = location; polygon.locationlabel = new locationlabel(location, latlng, mapprovider.map); google.maps.event.addlistener(polygon, 'click', function(e) { alert('hello'); }); this fine, displays alert when click polygon not actual label. how add listener alert displayed when label clicked?
try :
texttoshow = polygon.locationlabel; google.maps.event.addlistener(polygon, 'click', function(e, texttoshow) { alert(texttoshow); });
Comments
Post a Comment