htmx/www/content/attributes/hx-validate.md
William Jackson 46badfe0b1
Add descriptions for attribute pages (#3158)
Descriptions for attribute pages
2025-02-07 17:07:13 -07:00

16 lines
585 B
Markdown

+++
title = "hx-validate"
description = """\
The hx-validate attribute in htmx will cause an element to validate itself using the HTML5 Validation API before it \
submits a request."""
+++
The `hx-validate` attribute will cause an element to validate itself by way of the [HTML5 Validation API](@/docs.md#validation)
before it submits a request.
Only `<form>` elements validate data by default, but other elements do not. Adding `hx-validate="true"` to `<input>`, `<textarea>` or `<select>` enables validation before sending requests.
## Notes
* `hx-validate` is not inherited