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

264
Views
Diferentes botones que alternan el mismo contenido

hay 3 botones y cuando haces clic en 3 de ellos muestran el mismo contenido. Necesito mostrar el contenido único de los botones cuando haces clic en ellos por separado. ¿Cómo hacer que cada botón muestre el contenido único de div?

 function myFunction() { var x = document.getElementById("myDIV"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } }
 span { cursor:pointer;}
 <span onclick="myFunction()"class="total">button</span> <div id="myDIV" style="display:none;" class="expandable"> content 1 </div> <span onclick="myFunction()" class="total">button2</span> <div id="myDIV" style="display:none;" class="expandable"> content 2 </div> <span onclick="myFunction()" class="total">button3</span> <div id="myDIV" style="display:none;" class="expandable"> content 3 </div>

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

0

Le diste a los 3 divs la misma identificación, que no es lo que quieres, por supuesto, porque la identificación es un selector único para elementos.

Desde este punto puedes solucionar tu problema.

Saludos

about 4 years ago · Juan Pablo Isaza Report

0

¿Por qué tienes la misma identificación para tres botones? Creo que puede actualizar su contenido con una identificación de botón diferente.

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!