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

191
Vistas
Take button value and pass it into modal

I have a site, where I loop through a bunch of data & produce a button for each element.

I have set the button value for each, to be the unique youtube video URL

<button type="button" class="btn btn-outline-primary mb-1" data-bs-toggle="modal" data-bs-target="#Zdq6f4RXJt" value="#Zdq6f4RXJt">Video</button>

I then have a modal for each video. Which is not optimal.

How can I pass the value from the button into the modal?

Thanks a lot

 <div class="modal fade" id="Zdq6f4RXJt" tabindex="-1" role="dialog" aria-hidden="true">
                            <div class="modal-dialog modal-semi-full modal-dialog-centered">
                              <div class="modal-content">
                                <div class="modal-header">
                                        <h5 class="modal-title">Introduction to MongoDB</h5>
                                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                </div>
                                <div class="modal-body">
                                        <iframe width="100%" height="100%" src="https://www.youtube.com/embed/**Zdq6f4RXJt**" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
                                        </div>
                                <div class="modal-footer">
                                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                                </div> 
                              </div>
                            </div> 
                          </div> 
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

add onClick listener to the button and update the modal with a data attribute which can be referred at later point of time inside the modal.

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