Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active September 30, 2015 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/3b741e6185f058fdb4bc to your computer and use it in GitHub Desktop.
Save bjoerntx/3b741e6185f058fdb4bc to your computer and use it in GitHub Desktop.
// this function attaches the ZeroClipboard plugin
// to the newly created button and handles the events
function attachZeroClipboard() {
var sRTFToCopy = $("#TextBox1").val();
var client = new ZeroClipboard(document.getElementById('clipboardDropDown'));
client.on('ready', function (event) {
client.on('copy', function (event) {
event.clipboardData.setData('application/rtf', sRTFToCopy);
});
client.on('aftercopy', function (event) {
showMessage("Formatted content has been copied to the client clipboard.");
$("#clipboardDropDown").css("visibility", "hidden");
});
});
client.on('error', function (event) {
ZeroClipboard.destroy();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment