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

139
Views
Tengo 2 elementos dentro de un elemento div y 1 tiene la visibilidad oculta. Al hacer clic, quiero que el oculto se vuelva visible, pero no está haciendo esto.

Tengo un div y un img dentro de un div principal.

Supongo que si hago clic en la parte superior del div principal, el img se configurará como visible como se muestra a continuación.

El img no se vuelve visible cuando hago clic en el div principal. ¿Qué estoy haciendo mal?

 function displayLock(display_square) { if (display_square == 4) { document.getElementById("sq4").style.visibility = "visible" } }
 img#sq4 { visibility: hidden; }
 <div class="twenty-three" id="twenty-three"> <div id="question">?</div> <img id="sq4" src="./lock_1.png" onclick="displayLock(4)" /> </div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Su detector de eventos está en el elemento invisible

Prueba esto

 function displayLock() { document.getElementById(this.dataset.id).style.visibility = "visible" } document.getElementById("question").addEventListener("click",displayLock)
 img#sq4 { visibility: hidden; }
 <div class="twenty-three" id="twenty-three"> <div id="question" data-id="sq4">?</div> <img id="sq4" alt="sq4" src="./lock_1.png" /> </div>

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