I tried following this: https://jsfiddle.net/gevorgha/fbeof421/
Here is the code in my html file:
<!DOCTYPE html>
<html lang="en">
<head>
[...]
<script type="text/javascript" src="{{ url_for('static', filename='js/clipboard.min.js') }}"></script>
<script>
new Clipboard('.btn');
</script>
<body>
<!-- Target -->
<div id="bar">Mussum ipsum cacilds...</div>
<!-- Trigger -->
<button class="btn" data-clipboard-action="copy" data-clipboard-target="#bar">
Copy to clipboard
</button>
</body>
</html>
The issue I'm experiencing is not related to
"{{ url_for('static', filename='js/clipboard.min.js') }}"
When looking at my browser console, I see the following error message:
clipboard.min.js:7 Uncaught TypeError: Cannot read property 'addEventListener' of null
at o (clipboard.min.js:7)
at c (clipboard.min.js:7)
at o (clipboard.min.js:7)
at e.t [as listenClick] (clipboard.min.js:7)
at new e (clipboard.min.js:7)
at (index):13
o @ clipboard.min.js:7
c @ clipboard.min.js:7
o @ clipboard.min.js:7
t @ clipboard.min.js:7
e @ clipboard.min.js:7
(anonymous) @ (index):13
The jsfiddle example provided works fine, unlike mine. Any suggestions on how to resolve this issue?