<button class="btn" data-clipboard-text="Just because you can doesn't mean you should — clipboard.js">
Copy to clipboard
</button>
var clip = new Clipboard('.btn');
clip.on("success", function() {
document.body.insertAdjacentHTML('beforeend', '<div>that worked.</div>');
});
clip.on("error", function() {
document.body.insertAdjacentHTML('beforeend', '<div>that didn\'t work.</div>');
});
This Pen doesn't use any external CSS resources.