Debian Codegraph @

www/src/content/reference/01-attributes/23-hx-validate.md

raw symbols SCIP
1 ---
2 title: "hx-validate"
3 description: "Validates before submitting the request"
4 ---
5
6 The `hx-validate` attribute will cause an element to validate itself by way of
7 the [HTML5 Validation API](/docs#validation)
8 before it submits a request.
9
10 ## Syntax
11
12 ```html
13 <input hx-post="/submit" hx-validate="true">
14 ```
15
16 Only `<form>` elements validate data by default, but other elements do not. Adding `hx-validate="true"` to `<input>`,
17 `<textarea>` or `<select>` enables validation before sending requests.