Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda