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

207
Views
Get data from thymeleaf to a modal bootstrap, jquery

I am trying to get an "id" to a modal view, this is in order to updated a "onclick" element, but I don't find a way :(, any idea how this could be done for boostrap 5 , ¿or other way I could do it? Thanks !

  <tr th:each="user: ${users}">
    <a data-bs-toggle="modal" th:title="active" th:id="${user.id}"   th:attr="data-target='#modal-warning'+${user.id }" data-bs-target="#modal-view">inactivate</a>
<div th:fragment="modal" class="modal fade modal-warning" th:id="modal-warning+${clinicalRepresentative.id }" tabindex="-1" role="dialog" aria-labelledby="label-modal-1" > 
<div class="modal-dialog">
    <div class="modal-footer">

<input  th:onclick="'location.href=\'/inactivate/' + (id=${clinicalRepresentative.id}) +'\''"            /> 
<script>
    $(document).ready(function() {
        var id;
        $('[title="active"]').click(function() {
            id = $(this).attr('id');
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Finally, thanks to lot of searching and trying, I found the solution, hope it helps with who is struggling, the trick is to put the modal inside the same loop of the table or div, and creating and dynamic "id" with the attribute sentence of thymeleaf, like is explained in this page for an older version:

    <tr th:each="user: ${users}">
        <td ><a data-bs-toggle="modal" data-row="${user}"
                th:attr="data-bs-target='#modal-warning'+${user.id }">Inactivate</a> 
    
    <!--  MODAL -->
  <div th:fragment="modal" class="modal fade" th:id="modal-warning+${user.id }" tabindex="-1"
about 4 years ago · Juan Pablo Isaza Report
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!