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

137
Vistas
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 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