Reputation: 1269
I am using Leaflet API to draw some markers on the map. My marker data is populated using HTML which displays fine when clicked on. The problem is when hovered on top of the marker it displays the html tags also. Either I want to disable the hover entirely OR show the data only on hover also excluding the Html tags OR show empty string on hover which ever is easier.
My code (JS):
for (var i = 0; i < arr.length; i++) {
var a = arr[i];
var title = a[2];
var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
marker.bindPopup(title);
layer.markers.addLayer(marker);
}
map.addLayer(layer.markers);
Upvotes: 1
Views: 2609
Reputation: 10008
You have to remove the option title
var marker = new L.Marker(new L.LatLng(a[0], a[1]));
instead of
var marker = new L.Marker(new L.LatLng(a[0], a[1]), { title: title });
Ref: http://leafletjs.com/reference.html#marker
Upvotes: 2