Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
Halo
<br>
<textarea placeholder="Paste disini"></textarea>
 
const year = new Date();
const copyListener = (event) => {
  const range = window.getSelection().getRangeAt(0),
    rangeContents = range.cloneContents(),
    info = `© ${year.getFullYear()} LIGMATV`,
    helper = document.createElement("div");
  helper.appendChild(rangeContents);
  event.clipboardData.setData("text/plain", `${helper.innerText}\n${info}`);
  event.clipboardData.setData("text/html", `${helper.innerHTML}<br>${info}`);
  event.preventDefault();
};
document.addEventListener("copy", copyListener);
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers