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

145
Views
Abrir modal de arranque distante
let readcomment = event.target.closest(".read-comment"); let dataAttribute = readcomment.getAttribute('data-id'); let url = "../comments/" + dataAttribute + "/"; fetch(url) .then(function (response) { return response.text(); }) .then(function (data) { console.log(data) }) .catch(function (error) { console.log(error); });

Cuando se hace clic en "leer comentario", obtengo el valor de identificación de datos y construyo la variable URL.

Obtengo los datos de la URL con la función de búsqueda JS.

Me gustaría representar los datos obtenidos en un modal de arranque (usando el arranque 5)

En bootstrap, la documentación dice que podemos crear un modal con

 var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)

En mi proyecto, el botón "Leer comentario" está en el primer archivo y el contenido de "myModal" está en un segundo archivo diferente, y luego, cuando se hace clic en el botón, el código anterior devuelve:

 TypeError: this._element is undefined"

El problema es que "document.getelementbyid("myModal")" devuelve un valor nulo porque myModal está en otro archivo que no está cargado en la primera página.

¿Cómo debería hacer?

Gracias por tu ayuda.

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