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>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<button class="btn" data-clipboard-text="Just because you can doesn't mean you should — clipboard.js">
Copy to clipboard
</button>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js"></script>
<script>
new ClipboardJS('.btn');
</script>
</body>
</html>
Post a Comment for "Data-clipboard-text Is Not Working While Using Clipboard.js"