fix: initialize htmx on dynamically loaded dom nodes

This commit is contained in:
Björn Fromme
2024-11-14 16:06:28 +01:00
parent f79096c11a
commit fa3fde986f
3 changed files with 3 additions and 0 deletions
@@ -50,6 +50,7 @@ export default class extends Controller {
this.loadedValue = true this.loadedValue = true
this.containerTarget.innerHTML = html this.containerTarget.innerHTML = html
this.triggerTarget.remove() this.triggerTarget.remove()
htmx.process(this.containerTarget)
}) })
.catch(() => { .catch(() => {
this.loadedValue = false this.loadedValue = false
@@ -39,6 +39,7 @@ export default class extends Controller {
.then(html => { .then(html => {
this.resultsContainerTarget.innerHTML = html this.resultsContainerTarget.innerHTML = html
window.scroll({ top: 0, left: 0, behavior: 'smooth' }) window.scroll({ top: 0, left: 0, behavior: 'smooth' })
htmx.process(this.resultsContainerTarget)
}) })
.finally(() => { .finally(() => {
this.loadingValue = false this.loadingValue = false
@@ -28,6 +28,7 @@ export default class extends Controller {
.then(this.parseHTML) .then(this.parseHTML)
.then(html => { .then(html => {
this.containerTarget.innerHTML = html this.containerTarget.innerHTML = html
htmx.process(this.containerTarget)
}) })
.finally(() => { .finally(() => {
this.loadingValue = false this.loadingValue = false