Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

244
Views
javascript: how to copies a part of html containing images to the clipboard without using the execCommand command

the goal is to copy a div containing text and an image to create the body of an email to be pasted on the email client. I can do this with the execCommand (copy) command but being deprecated I would like to arrive at a solution using the Clipboard API. With Clipboard I can copy the text via the write function passing the html element by id but this eliminates any formatting of the text and images.

application that create template for email body

    var toCopy = document.getElementById("riepilogonegozio")
    var r = document.createRange();
    r.selectNode(toCopy);
    console.log(r)
    window.getSelection().removeAllRanges();
    window.getSelection().addRange(r);
    console.log(r)
    document.execCommand('copy');
    window.getSelection().removeAllRanges();
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!