Answers for "javascript put into clipboard"

26

javascript text to clipboard

function copyToClipboard(text) {
   const elem = document.createElement('textarea');
   elem.value = text;
   document.body.appendChild(elem);
   elem.select();
   document.execCommand('copy');
   document.body.removeChild(elem);
}
Posted by: Guest on March-20-2020
0

javascript enable clipboard

// Paste into the JS console on the page in question
var allowPaste = function(e){
  e.stopImmediatePropagation();
  return true;
};
document.addEventListener('paste', allowPaste, true);
Posted by: Guest on May-12-2021

Code answers related to "javascript put into clipboard"

Code answers related to "Javascript"

Browse Popular Code Answers by Language