Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

318
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!