I’m using Leaflet.js for a project and I’d like to bind events on my markers with jQuery on().
I tested something like :
$('body').on("hover",".leaflet-marker-icon",function(){console.log("foo")}) //doesn't work
but nothing happens.
On the other hand, it works when I bind the events directly :
$(".leaflet-marker-icon").hover(function(){console.log("bar")}) //works
I tested jQuery.on() on another div of my page :
$('body').on("hover",".navbar",function(){console.log("g")}) //no problem
This one works fine.
Any clue?
seems that propagation does not happen. You need to provide more code to get more precise answer. For now I suspect that
.stopPropagation()is called somewhere