JavaScript - Copy Text with ZeroClipboard Example
(function(){
$.getScript('//cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.2.0/ZeroClipboard.min.js', function(data, textStatus) {
// <input type="text" id="input-to-copy" value="Foobar"> <button id="copy-trigger-button" data-clipboard-target="input-to-copy">Copy URL</button>
var button = document.getElementById('copy-trigger-button');
ZeroClipboard.config( { swfPath: "//cdnjs.cloudflare.com/ajax/libs/zeroclipboard/2.2.0/ZeroClipboard.swf" } );
button.client = new ZeroClipboard( button );
button.client.on('ready', function( readyEvent ) {
button.client.on( 'aftercopy', function(e) {
$(e.target).after('<div class="alert alert-success">XML Coppied to Clipboard!</div>');
$(e.target).next().delay(500).fadeOut();
});
});
});
})();