mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00

* Update disable-element extension Allow multiple elements to be selected in the query * Remove unnecessary comments https://github.com/bigskysoftware/htmx/pull/1650#discussion_r1278773982 * Change tab indentations to spaces
911 B
911 B
+++ title = "disable-element" +++
This extension disables an element during an htmx request, when configured on the element triggering the request.
Install
<script src="https://unpkg.com/htmx.org/dist/ext/disable-element.js"></script>
Usage
Nominal case: disabling the element triggering the request
<button hx-get="/whatever" hx-ext="disable-element" hx-disable-element="self">Click me</button>
Disabling another element
<button hx-get="/whatever" hx-ext="disable-element" hx-disable-element="#to-disable">Click me</button>
<button id="to-disable">Watch me being disabled</button>
Disabling multiple elements
<button hx-get="/whatever" hx-ext="disable-element" hx-disable-element=".to-disable">Click me</button>
<button class="to-disable">Watch me being disabled</button>
<button class="to-disable">Watch me being disabled also</button>