Modal window not working properly in a for cycle heex


Working with phx 1.6 in heex I have a cycle inside a table:

<%= for user <- @users do %>
 <!-- some tr -->
    Open Modal
    <div id="myModal" class="hidden modal">
     <!-- Modal things -->


Now, the problem is not with the modal itself. Clicking on Open Modal for first row, eg index 0, the modal opens, but clicking on the second Open Modal generated by the for cycle <%= for user <- @users do %> exactly nothing happens… Why? It seems as the js for the modal only works for index 0…
The modal must stay in the for cycle because I have a form inside it using user variables. Just to say - I have removed all tailwind classes for simplify


Makre sure your modals have unique ids. Using an id more than a single time is invalid in html.