Hi i have this JavaScript Code. But i get the error: "Uncaught ReferenceError: saveMarker is not defined" from the console when i click the "save" button. I call the code below from my "main" HTML file with a script block. The Popup is functioning but when i klick on save the error comes up.
I use it with the leaflet library which is referenced by the "L" if someone is wondering. I also added a picture of the project.
I Tried this Version:
export function markerpopup(map, latlng) {
    console.log("starte markerpopup");
    var actual_location = "";
    var popupContent = `
      <button onclick="saveMarker()">Speichern</button>`;
    L.popup()
        .setLatLng(latlng)
        .setContent(popupContent)
        .openOn(map);
}
function saveMarker() {
    console.log("starte saveMarker");
}
And this Version (Which should be the same as https://www.w3schools.com/JSREF/event_onclick.asp):
export function markerpopup(map, latlng) {
    console.log("starte markerpopup");
    var actual_location = "";
   var popupContent = `
            <button onclick="saveMarker()">Speichern</button>
            <script> 
                function saveMarker() {
                    console.log("starte saveMarker");
                }
            </script>`;
    L.popup()
        .setLatLng(latlng)
        .setContent(popupContent)
        .openOn(map);
}
Would appreciate if someone could help!
Tried different places to place the saveMarker function.
 
     
     
     
    