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

195
Views
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
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!