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

193
Vistas
JavaScript doesn't work in Thymeleaf and Spring Boot

JavaScript doesn't work in Thymeleaf. In Spring Boot Thymeleaf, first thing can open modal.

but second, third ... things can not open modal.

every thing has a className. but only first thing can open modal.

I think JavaScript works only the first thing, and doesn't work other things.

<tr th:each="board, i : ${boards}">
                        <th scope="row" th:text="${i.count}">1</th>
                        <td>
                            <p id="show" th:text="${board.title}">Title</p>
                            <div class="modal"> .... </modal>
                        </td>
                        <td th:text="${board.writer}">이재윤</td>
                        <td th:text="${board.createDate}">2022-02-01</td></p>
</tr>

js

function show() {
    document.querySelector(".background").className = "background show";
}

function close() {
    document.querySelector(".background").className = "background";
}

document.querySelector("#show").addEventListener("click", show);
document.querySelector("#close").addEventListener("click", close);
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