`setAttribute('hx-ignore')` does not disable htmx in 4.0
Author: salomvaryCreated Sep 10, 2026Updated Sep 10, 2026
Was working with setAttribute('hx-disable'), 4.0 upgrade documents claim that this attribute was only "renamed" but there seems to be a behavior change: https://four.htmx.org/docs/whats-new-in-htmx-4
Showcase:
<!doctype html>
<title>Test</title>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/htmax.js"
integrity="sha256-fefTvViCN3FkUZr3FwhEtzdQVMDzT2F/rOyk86Um93E="
crossorigin="anonymous"></script>
<script>
htmx.config.logAll = true;
</script>
<button onclick="this.nextElementSibling.setAttribute('hx-ignore', '')">Ignore next button</button>
<button hx-get="" hx-swap="none">Click me</button>
Expected: Clicking "Click me" should not make a request after clicking "Ignore next button". Actual: It makes a request.
Workaround:
Use htmx.process(element, true) after setting hx-ignore.
<button onclick="this.nextElementSibling.setAttribute('hx-ignore', ''); htmx.process(this.nextElementSibling, true)">Ignore next button</button>
<button hx-get="" hx-swap="none">Click me</button>
Source: bigskysoftware/htmx