Well the title says it all but here is some code so you see what i mean.
function eachFeature(feature, layer) {
layer.on({
mouseover: highlight
Using Leaflet 1.x, here is a slightly different way to do this - in my case the map was already initialized, so the className styling mentioned above did not work.
function eachFeature(feature, layer) {
layer.on({
mouseover: function(e) {$(e.target.getElement()).addClass("active");},
mouseout: function(e) {$(e.target.getElement()).removeClass("active");}
});
}
You can also set the class attribute directly using setAttribute on e.target.getElement() if you're not using jQuery.