$(function () { var clipboard = new Clipboard('.copy'); clipboard.on('success', function(e) { $(e.trigger).text('Copied!') setTimeout( function () { $(e.trigger).text('Copy'); }, 2000 ); }); clipboard.on('error', function(e) { $(e.trigger).text('Couldn\t copy :(') setTimeout( function () { $(e.trigger).text('Copy'); }, 2000 ); }); });