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

255
Views
How to get a position of substring inside textarea in pixcels?

I have a long text (with multipe-line) inside textarea. Now I'd like to find some substrings in the text and cover it with the aboslute positioned div (like cover an expression inside the text with some tag). For example:


Lorem ipsum dolor sit <TAG_1> amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea <TAG_2> commodo consequat.

Duis aute irure dolor in reprehenderit in voluptate cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit <TAG_3> id est laborum.


So here I need to find positions of <TAG_1>, <TAG_2> and <TAG_3> (in pixels), and based on them create 3 divs with absolute position to cover them.

I've tried also to implement it using contenteditable="true" div (to have these tag-divs and the rest of text displayed inline), but the problem is that it breaks lines after the tag.

Is it possible or maybe there is a better approach?

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!