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

301
Vistas
How to get cursor position in contenteditable div including HTML tags?

I'm writing a program where I need the position of the cursor in an editable div, and tags should be counted as well.

Example:

<div contenteditable="true">
<p>Text here!</p>
</div>

If the cursor is placed after "Text", the cursor position should be 7, not 4. This happens when the HTML tag is included.

Solutions like this one: https://stackoverflow.com/a/53128599/12834165, only count the visible characters, resulting in the output being 4.

about 4 years ago · Santiago Trujillo
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