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

323
Vistas
changing tooltip clickable not hover & making tooltip close once button is clicked

so I am testing adding a tooltip to a website

<div class="tooltip">
        <span class="price-line">click here</span>
        <div class="tooltiptext tooltip-top">
            <span class="close">
            X
            </span>
            <h1 class="tooltip-title">should open on click</h1>
            <p class="tooltip-msg"> close when X is clicked</p>
        </div>
</div>

here is my jsfiddle: https://jsfiddle.net/z64ndm85/

current state of tooltip (image)

my questions:

(1) as you can see in the image above right now my tooltip shows when "Click here" text hovers. I want to change this so that tooltip shows when the "click here" text is clicked. I tried using "active" instead of hover but the problem with that approach is the tooltip dialog shows only while the text is being clicked. I want the dialog to show permanently after the text is clicked.

(2) once the tooltip dialog is showing, I want to make it so that the user can close the dialog once the user clicks on X. I tried running $document.tooltiptext tooltip-top.hide() when onclick() but it is not working. how can I go about this?

also, where do I add the above code to close the dialog for onclick() in my HTML? do I add it as a ?

thanks!!

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