JSFiddle - React, Tailwind, and code Playground

by Mohammed Ismail Ansari

HTML

Mass Effect developer BioWare, for example, helped one couple get engaged by creating a completely unique level rendered in the next Mass Effect's engine. In a truly heartwarming post on BioWare's site the developer details the setup and the execution ...
<p>Mass Effect developer BioWare, for example, helped one couple get engaged by creating a completely unique level rendered in the next Mass Effect's engine. In a truly heartwarming post on BioWare's site the developer details the setup and the execution ...</p>
Mass Effect developer BioWare, for example, helped one couple get engaged by creating a completely unique level rendered in the next Mass Effect's engine. In a truly heartwarming post on BioWare's site the developer details the setup and the execution ...
Mass Effect developer BioWare, for example, helped one couple get engaged by creating a completely unique level rendered in the next Mass Effect's engine. In a truly heartwarming post on BioWare's site the developer details the setup and the execution ...

CSS

body {
    color: White;
    background: Black;    
}

JavaScript

var body = document.getElementsByTagName("body")[0];

body.addEventListener("copy", function () {
    var selection = window.getSelection(),
        dummyDiv = document.createElement('div');
    
    dummyDiv.style.position = "absolute";
    dummyDiv.style.left = "-99999px";
    dummyDiv.style.color = "black";
    dummyDiv.style.background = "White";

    document.body.appendChild(dummyDiv);
    dummyDiv.innerHTML = selection;
    selection.selectAllChildren(dummyDiv);
    
    window.setTimeout(function () {
        document.body.removeChild(dummyDiv);
    }, 100);
});