Created
April 28, 2017 18:26
-
-
Save mircian/5d8e3f8d3151fe821a55448859ae6c32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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