2024-10-15 15:37:25 +00:00
|
|
|
## HTMX Extensions - Trigger Children
|
2024-10-10 14:07:03 +00:00
|
|
|
|
|
|
|
|
The `trigger-children` extension allows you to trigger an event on all children and siblings of an element.
|
|
|
|
|
|
|
|
|
|
This is useful for things such as:
|
|
|
|
|
1. Letting a child element (such as a button) inside a form know the form was submitted
|
|
|
|
|
|
|
|
|
|
<br>
|
|
|
|
|
|
2024-10-29 10:11:35 +00:00
|
|
|
**Example:** https://htmgo.dev/examples/form
|
2024-10-10 14:07:03 +00:00
|
|
|
|
|
|
|
|
In this example: The trigger-children extension will trigger **hx-before-request** and **hx-after-request**
|
|
|
|
|
on all children of the form when the form is submitted, and the button reacts to that by showing a loading state.
|