for(let feature of features){
$("#menuList").append("<li></li>");
}
$("#menuList li").on('click', function(ev){
// I need a reference to the original feature object here
});
What is the best way to get a reference to the original feature-object within the click handler (without passing some ID as a data tag and iterating over the list again)?
Ideally, I could do something like
for(let feature of features){
$("#menuList").append("<li></li>").on('click', function(feature){ //do something with the feature object });
}
But this does not work.