Data-clipboard-text Is Not Working While Using Clipboard.js
I have a simple structure to test clipboard.js but it's not working. I used in a simple file because it was not working in the project too:
Solution 1:
you need to instantiate it by passing a DOM selector, HTML element, or list of HTML elements.
new ClipboardJS('.btn');
https://clipboardjs.com/#setup
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><title>Document</title></head><body><buttonclass="btn"data-clipboard-text="Just because you can doesn't mean you should — clipboard.js">
Copy to clipboard
</button><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script><script>newClipboardJS('.btn');
</script></body></html>
Post a Comment for "Data-clipboard-text Is Not Working While Using Clipboard.js"