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

190
Views
textarea with highlight and clickable words in React JS

I am new to React (not that experienced with frontend in general). I am looking for a solution to my simple spell checker where I want to submit a form with a textarea and highlight the wrong words, which may be hovered to show a correction suggestion.

I have tried the 'react-highlight-within-textarea' component, but it just highlights the words and seems to have some bugs when moving the cursor and writing more words.

I have tried the following code on a normal textarea:

const handleSelect = () => {
    const selection = window.getSelection();

    if (!selection.toString()) return;

    const edt = editorRef.current;
    const { selectionStart, selectionEnd } = edt;

    setSelected({
      start: selectionStart,
      end: selectionEnd,
      text: selection.toString()
    });
};

This code gives me the word clicked, but the textarea does not support HTML, so I cannot highlight any words. It also only works when double clicked (do not understand why). Moreover, I do not know how to make the hover behaviour as there does not seem to exist any event to handle that kind of behaviour.

Does anyone have any ideas as to how to achieve the desired behaviour?

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!