I have a function that feeds variables to a Popup, which is working so far. Now I inserted a button in this Popup and want some function to run when clicked on this, but the the object is not accessible for my external function. How can I rewrite this function, to access the single elements more easy?
marker:
var marker = L.marker([data[i].lat, data[i].lng], {icon: greenIcon}).addTo(map);
marker.bindPopup(id + "<br>" + species + "<br>" + diameter + "<br>" + quality + "<br>" + damage + "<br>" + notes + "<br>" + "<br>" +
'<input type="submit" id = "delete" name="action" data-value = " + id + " value="Delete" method = "post"/>');
function:
<script type="text/javascript">
$(function(){
$('#delete').click(function(d){
alert("deleted")
});
});
</script>