flowbite
flowbite copied to clipboard
Closing a Modal whose close button is in an HTML content located elsewhere inserted into the DOM via HTMX
<form hx-post="{% url 'my_nice_url' %}" hx-target="this" hx-swap="innerHTML">
{% include "../partials/some-form.html" %}
</form>
In some-form.html I have :
<div>
<button type="submit">Update</button>
<button data-modal-hide="modal-myModal" type="button">Close</button>
</div>
If I click the update button, I'll get the confirmation displayed via HTMX and it contains a close button - close button being :
<button data-modal-hide="modal-myModal" type="button">Close</button>
But clicking on the close button on form POST doesn't close the form.
Is this because the button is located in a file elsewhere which get updated into the DOM via HTMX ?