I have installed clipboard.js on a website, but when the page loads I get the following error in firebug
The relevant code is as follows
Closing this one since no code has been provided, but I'm assuming it's duplicated from https://github.com/zenorocha/clipboard.js/issues/141
@zenorocha I have exactly the same error. I've added the following code to the header of the page:
<script src="{% static "clipboard/dist/clipboard.js" %}" type="text/javascript"></script>
<script type="text/javascript">
new ClipboardJS('.btn');
</script>
I have two copy buttons with class btn on my page. Buttons doesn't work and I see the same exception in the console.
When I change to the non-minified version, I get:
TypeError: elements is null
[袩芯写褉芯斜薪械械]
clipboard.js:789:9
delegate
http://localhost:8000/static/clipboard/dist/clipboard.js:789:9
listenSelector
http://localhost:8000/static/clipboard/dist/clipboard.js:417:12
listen
http://localhost:8000/static/clipboard/dist/clipboard.js:358:16
listenClick
http://localhost:8000/static/clipboard/dist/clipboard.js:622:34
Clipboard
http://localhost:8000/static/clipboard/dist/clipboard.js:596:13
<邪薪芯薪懈屑薪邪褟>
http://localhost:8000/reports/:24:5
@zenorocha Ah, sorry, I got it. I should move initialization to the end of the body element. You may emphasize this moment in the documentation or use live handlers...
Most helpful comment
@zenorocha Ah, sorry, I got it. I should move initialization to the end of the body element. You may emphasize this moment in the documentation or use live handlers...