Copying to clipboard only works .. sometimes?

Hey guys, I’m using LeafletJS to make myself a map tool where I can add markers to the map.

I’m still new to Js but so far it’s working, I can click on the map, it prompts me for a name, description and icon choice and it copies the code into my clipboard which I paste in my markers.js document for it to permanently appear on the map.

The problem is sometimes, it won’t copy the code to my clipboard and I can’t figure out why.

Any help MUCH appreciated as I’m going crazy!

HTML/Js: <!doctype html><html><head> <meta charset="utf-8"> <title>Westergr -
And the markers.js file with some entries: (pastebin) /DaKcU0yi

Here is the entire project:

Thank you so much.