<!DOCTYPE html>
<html>
<body>
<h2>Example:</h2>
<!-- 1. Define some markup -->
<button class="btn"
data-clipboard-text="unitysheepers.zapto.org">
Copy to clipboard
</button>
<!-- 2. Include library -->
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<!-- 3. Instantiate clipboard by passing a list of HTML elements -->
<script>
var btns = document.querySelectorAll('button');
var clipboard = new ClipboardJS(btns);
clipboard.on('success', function(e) {
console.log(e);
});
clipboard.on('error', function(e) {
console.log(e);
});
</script>
</body>
</html>