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

97
Views
Contenteditable paste as plain text

I would like to restrict the paste text on the contenteditable to plain text. I have a html file and ts file.

I tried using this method but it keeps showing this error message: Property 'clipboardData' does not exist on type 'Event'.

window.onload = function(){
  document.querySelector('#divId').addEventListener('paste', (e) => {
      e.preventDefault();
      const text = e.clipboardData.getData('text/plain');
      console.log(text);
      window.document.execCommand('insertText', false, text);
  })
}
<div contenteditable="true" id="divId" style="border: 1px #ebedf2 solid; font-size: 17px; font-weight: 600; font-family: sans-serif; color: #575962;"></div>

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!