From 8abdc78b608a7424b9a6ec5ff9b9e61c5b61839e Mon Sep 17 00:00:00 2001 From: Lincoln Puzey <18750802+LincolnPuzey@users.noreply.github.com> Date: Thu, 13 Nov 2025 09:12:28 +0800 Subject: [PATCH] Clarify behavior and examples of hx-disabled-elt in the docs Fixes https://github.com/bigskysoftware/htmx/issues/3081 --- www/content/attributes/hx-disabled-elt.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/www/content/attributes/hx-disabled-elt.md b/www/content/attributes/hx-disabled-elt.md index 3c6845bae..1e5506a52 100644 --- a/www/content/attributes/hx-disabled-elt.md +++ b/www/content/attributes/hx-disabled-elt.md @@ -8,7 +8,7 @@ description = """\ The `hx-disabled-elt` attribute allows you to specify elements that will have the `disabled` attribute added to them for the duration of the request. The value of this attribute can be: -* A CSS query selector of the element to disable. +* A CSS query selector of the elements to disable. * `this` to disable the element itself * `closest ` which will find the [closest](https://developer.mozilla.org/docs/Web/API/Element/closest) ancestor element or itself, that matches the given CSS selector @@ -21,6 +21,8 @@ added to them for the duration of the request. The value of this attribute can b * `previous ` which will scan the DOM backwards for the first element that matches the given CSS selector. (e.g. `previous input` will disable the closest previous sibling `input` element) +Or a comma-separated list of the above options (except for `this`). + Here is an example with a button that will disable itself during a request: ```html @@ -36,14 +38,14 @@ The `hx-disabled-elt` attribute also supports specifying multiple CSS selectors elements during the request. Here is an example that disables buttons and text input fields of a particular form during the request: ```html -
+
``` Note that you can also use the `inherit` keyword to inherit parent values for a disabled elements and add additional -disabled element CSS selectors: +disabled elements: ```html