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

129
Views
Simulating the paste's event automated scrolling

I am working with a <div contenteditable></div> element, and I wanted to override the default paste event to remove all sorts of formatting.

document.querySelector("div[contenteditable]").addEventListener("paste", function(event) {
    event.preventDefault();
    document.execCommand("insertText", false, event.clipboardData.getData("text/plain"));
});

It works, but when pasting something, once it overflows the current scrolled area, it is required for the user to scroll down manually.

enter image description here

I've thought about scrolling into the caret's location, but I have no idea how to do this, as it is not a DOM element. What could be the solution to the problem? Any help is appreciated!

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!