Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<a href="javascript:void(0);" data-clipboard-text="This is the text to copy!" class="btn-copy">
<span class="m_copy_text">Copy Link</span>
</a>
var clipboard = new Clipboard('.btn-copy');
clipboard.on('success', function(e) {
var trigger = jQuery(e.trigger);
var text_span = trigger.find('.m_copy_text');
var text = text_span.text();
text_span.text('Copied!');
setTimeout(function () {
text_span.text(text);
}, 2000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.