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
The code below will allow you to add a class after the paths are created by the geoJosn method with D3.
var svg = d3.select(map.getPanes().overlayPane).append("svg"),
g = svg.append("g").attr("class", "your_class");
However, if you want to add them on creation using only leaflet, try returning them in the style(feature) method like this:
function style(feature) {
return {
weight: 1,
opacity: .5,
fillOpacity: 0.7,
className: feature.properties.name_of_node
};
}
That worked really well for me.