copy,text,div,into,clipboard

Kubilay 9/23/2016 0

This code will copy content of control into the clipboard

JavaScript
 function CopyToClipboard(containerid) {
        if (document.selection) {
            var range = document.body.createTextRange();
            range.moveToElementText(document.getElementById(containerid));
            range.select().createTextRange();
            document.execCommand("Copy");

        } else if (window.getSelection) {
            var range = document.createRange();
            range.selectNode(document.getElementById(containerid));
            window.getSelection().addRange(range);
            document.execCommand("Copy");
        }
    } 

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments