); let $icon = $($btn.find('i')); $icon.removeClass('fa-copy'); $icon.addClass('fa-clipboard-check'); let $span = $($btn.find('span')); $span[0].innerText = 'COPYED'; }); clipboard.on('error', function(e) { e.clearSelection(); let $btn = $(e.trigger); $btn.addClass('copy-failed'); let $icon = $($btn.find('i')); $icon.removeClass('fa-copy'); $icon.addClass('fa-exclamation-triangle'); let $span = $($btn.find('span')); $span[0].innerText = 'COPY FAILED'; }); } initCopyCode(); }(window, document);