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

387
Vistas
Bootstrap event "shown.bs.modal" fires multiple times everytime I click the toggle button

I am building a pdf view with PDF.js to render pdf inside bootstrap modal, and according to the documentation I can listen to "shown.bs.modal" event when the modal popup is displayed so I have this code:

function renderPdfMobile() {
  docs.forEach(doc => {
    doc.addEventListener("click", function (e) {
      const file = e.target.dataset.file;

      var modal = document.getElementById("fileModal");
      modal.addEventListener('shown.bs.modal', function (event) {

      

      console.log(modal)

      })

    })

  })
}

renderPdfMobile()

Code works every time I click the modal button. The problem is it fires with the increment of +1 every time.

So in console When I click once, I get "fired" when I click again I get

"fired"
"fired"

another click results in:

"fired"
"fired"
"fired"

At this point, I don't know what I am doing wrong.

EDITED

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