0

Here is my code, I need to bind click event for ticketStatusCol class.

var map = new L.Map('map', {center : latlng, zoom : 1, layers : [cloudmade]}); 
var markers, prevStatus = null, archivedStatus, html = "", marker, title = "";
markers = new L.MarkerClusterGroup();
var html = "";
html += "<div class='ticketStatusCol'>";
html += "<div> Some html codes here </div>";
html += "</div>";
marker.bindPopup(html);
markers.addLayer(marker);
map.addLayer(markers);
  • 2
    please read http://stackoverflow.com/editing-help for using editor. It's difficult to edit this question for others also. – SachinGutte Apr 29 '13 at 12:10
  • See @TimoSperisen's answer to [this question](https://stackoverflow.com/questions/16927793/marker-in-leaflet-click-event) and [the Fiddle which he posted](https://jsfiddle.net/8282emwn/139/) It works for me – Mawg says reinstate Monica Nov 17 '19 at 20:09

1 Answers1

0

You need to set a click event on the container for the ticketStatusCol class divs. I don't know where they are put in, I'll just name it container for now:

$("#container").on("click", ".ticketStatusCol", function() {
    // Do stuff
});
Richard de Wit
  • 7,102
  • 7
  • 44
  • 54