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

186
Views
Resize a span highlighting a word to include multiple words of a text by dragging the span element

I want to resize the size of a span by dragging its border following the text characters.

Here's an image to better understand: enter image description here

I leave a stackblitz using React: https://stackblitz.com/edit/react-qvvqfe?file=src/App.js

As I said I'm using React, but a solution using Javascript alone it's fine.

Here's what I tried:

since I know the offset of the mention in the text like so:

{
   startPos: 5,
   endPos: 10
}

I just changed the mention positions to make the span larger and rerendered the document content. I'm doing this using an onClick event because I'm kind of lost when including the drag part.

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!