0

Essentially I'm trying to do a document.execCommand("Copy"), but some of the data I need to copy is located within href's. So I tried to replace the specific nodes of the document with simpler nodes, which could be copied directly, but this messes up the GUI. Then I thought I could simply clone the document, but Selection.addRange() can't find the range if it's not in the window.

I don't know if I'm simply taking the wrong approach, but if so, I can't seem to find the right one.

Any help is greatly appreciated.

Jules
  • 1
  • Create a fragment and copy that instead – mplungjan Jan 20 '21 at 15:24
  • Dan Stevens has a pretty good suggestion here: https://stackoverflow.com/questions/31593297/using-execcommand-javascript-to-copy-hidden-text-to-clipboard I know that question is about jQuery but Dan's answer is vanilla JS. – That'sIs JustCrazy Jan 20 '21 at 15:26

0 Answers0