Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

302
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda