Copy text to system Clipboard - Node.js Environment

Node.js examples for Environment:Clipboard

Description

Copy text to system Clipboard

Demo Code

function copyTextToClipboard(text) {
    var copyFrom = document.createElement("textarea");
    var body = document.getElementsByTagName('body')[0];

    copyFrom.textContent = text;//from www . j a v  a2  s  . co m
    body.appendChild(copyFrom);
    copyFrom.select();
    document.execCommand('copy');
    body.removeChild(copyFrom);
}

Related Tutorials