Skip to content

Instantly share code, notes, and snippets.

@inwardmovement
Created January 2, 2020 10:29
Show Gist options
  • Save inwardmovement/71378e8a3ff7ec7499e1f922431019f5 to your computer and use it in GitHub Desktop.
Save inwardmovement/71378e8a3ff7ec7499e1f922431019f5 to your computer and use it in GitHub Desktop.
Copy text on click (using JS)
// DISCORD COPY
function copyDiscord(discordTag) {
navigator.clipboard.writeText(discordTag).then(function() {
/* success */
$('button.discord').tooltip('show');
setTimeout(function(){
$('button.discord').tooltip('hide')
}, 2000);
}, function() {
/* fail */
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment