summaryrefslogtreecommitdiffstatshomepage
path: root/www/content/extensions/disable-element.md
blob: c45d10b4cc7f8268b1f962d9b1c4f4ede236e989 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
+++
title = "disable-element"
+++

**NOTE: This extensions functionality has been folded into the core of htmx via the `hx-disabled-elt` attribute**

This extension disables an element during an htmx request, when configured on the element triggering the request.

## Install

```html
<script src="https://unpkg.com/htmx.org/dist/ext/disable-element.js"></script>
```

## Usage

### Nominal case: disabling the element triggering the request
```html
<button hx-get="/whatever" hx-ext="disable-element" hx-disable-element="self">Click me</button>
```

### Disabling another element
```html
<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
```html
<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>
```