Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

167
Vistas
Using Document.getSelection on a div of contentEditable true which contains HTML tag

I am trying to build a text editor from scratch using Reactjs.

I am trying to use a div of contentEditable true which contains HTML tags like anchor tag etc. To select any string I am using the following code -

 var sel = document.getSelection()

If there is no tag, the selection object takes all content of div as a single part. But if there is an HTML tag, then the selection object works for children objects separately. i.e. selection.achorOffset returns value counting from the end of the previous HTML tag.

Try selecting content by more than one row

So far I did up to like this

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda