-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
I'm using htmx through the sprig implementation for Craft CMS. I love it.
I'm using javascript to dynamically inject some <input sprig type="checkbox"
beneath some existing checkboxes. The initial <input
trigger a htmx call when clicked - but the injected ones do not.
htmx.ajax("POST", "XX", {
values: {},
target: container,
swap: "innerHTML",
}).then(() => {
const $htmxComponents = document.querySelectorAll('.sprig-component');
if($htmxComponents) {
$htmxComponents.forEach($htmxComponent => {
htmx.process($htmxComponent);
});
}
});
So my initial htmx load is:
<input sprig type="checkbox" value="1" name="location[]">
And when the above htmx is loaded is then looks like
<input sprig type="checkbox" value="1" name="location[]">
<input sprig type="checkbox" value="2" name="location[]">
Clicking the first <input works, but the second isn't triggering anything.
Metadata
Metadata
Assignees
Labels
No labels