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

139
Visualizações
How to exclude the window.getSelection() to includes the tooltip text when selecting html text in Chrome (It is working fine in Firefox)

I had the following code

Html example

<p>
  <span class="highlighting-tooltip>I BEAT COVID
    <span class="highlighting-tooltiptext">CAPITAL ERROR</span>
  </span>
</p>

CSS File

.highlighting-tooltip {
    position: relative;
    display: inline-block;
}
.highlighting-tooltip .highlighting-tooltiptext {
    visibility: hidden;
    background-color: #333;
    color: #fff;
    margin-left: -90px;
    top:100%;
    margin-top:40px;
    user-select: none;
    z-index: 1;
}

.highlighting-tooltip:hover .highlighting-tooltiptext {
    visibility: visible;
}

In above the text "I BEAT COVID" is displayed in html and when hover with mouse pointer the tooltip is displayed. The problem is when I select this text "I BEAT COVID" and get the output of window.getSelection() then it also includes the text "CAPITAL ERROR"

I checked it is working fine in firefox and "CAPITAL ERROR" is not included only the chrome is giving this error. Is there any way in chrome to avoid this tooltip text to get included in window.getSelection() ?

about 4 years ago · Juan Pablo Isaza
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