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

118
Vistas
Mostrar cada sección por clic de botón

todo el mundo.

Me gustaría preguntar si es posible mostrar cada sección por clic de botón en JQuery o JS.

 <section style="display: none;">section1<section> <section style="display: none;">section2<section> <section style="display: none;">section3<section> <section style="display: none;">section4<section> <section style="display: none;">section5<section> <section style="display: none;">section6<section> <button>Show each per click</button>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Necesitará usar la función index() .. Vea el siguiente ejemplo

 $("button").on("click" , () => { let index = !$("section.show").length || $("section.show").index() == $("section").length ? 0 : $("section.show").index(); $("section") // all sections .removeClass("show") // remove show class to hide all sections .filter("section:eq("+index+")") // desired section by index .addClass("show"); // show the section }); // to show spacific section // index starts from 0 so 0 mean the first section change 0 to 1 or 2 ... and try it $("section").eq(0).addClass("show");
 section{ display : none; } section.show{ display : block; }
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <section>section1</section> <section>section2</section> <section>section3</section> <section>section4</section> <section>section5</section> <section>section6</section> <button>Show each per click</button>

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