Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

copy table to clipboard html

function selectElementContents(el) {
    var body = document.body, range, sel;
    if (document.createRange && window.getSelection) {
        range = document.createRange();
        sel = window.getSelection();
        sel.removeAllRanges();
        try {
            range.selectNodeContents(el);
            sel.addRange(range);
        } catch (e) {
            range.selectNode(el);
            sel.addRange(range);
        }
    } else if (body.createTextRange) {
        range = body.createTextRange();
        range.moveToElementText(el);
        range.select();
        
    }
document.execCommand("copy");
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #copy #table #clipboard #html
ADD COMMENT
Topic
Name
5+1 =