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
Expanding on @tbicr s answer, you should be able to do something like this:
function onEachFeature(feature, path) {
path.on('click', addClass);
}
function addClass(e){
var path = e.target;
var container = path._container;
$(container).attr('class', 'test');
}
geojson = L.geoJson(geojson_raw, { style: style, onEachFeature: eachFeature });
geojson.addTo(map);
EDIT: As always, I would be glad flor an explanation, if you decide to downvote, so I can improve it. This is the only answer so far, which describes how to add a class dynamically in detail and I can't see whats wrong with it.