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

74
Views
Electron clipboard.writeHTML is not a function

I wanted to access the clipboard using the Electron clipboard module. I wrote:

const clipboard = require("electron")
// add an eventlister on my button to copy the innerHTML of div "content" 
document.getElementById("copy").addEventListener("click", () => {
         const code = document.getElementById('content').innerHTML
         // the line below complains: "Uncaught TypeError: clipboard.writeHTML is  not a function"
         clipboard.writeHTML(code)
         
     })

I was wondering why and couldn't figure it out for a whole day. Any suggestion would be appreciated. Thank you!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Clipboard is not the default export from electron. You need:

const { clipboard } = require('electron')

See https://www.electronjs.org/docs/latest/api/clipboard

And MDN on export

about 4 years ago · Juan Pablo Isaza Report
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!