HTMLButtonElement - setCustomValidity(): Specify button type availability
#42234 opened on Dec 4, 2025
Description
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/setCustomValidity
What specific section or headline is this issue about?
No response
What information was incorrect, unhelpful, or incomplete?
Subsequent to spending a few hours testing and looking for the relevant information, I found out from #dom:mozilla.org that the specification only allows HTMLButtonElement: setCustomValidity() method for button type="submit".
It would be beneficial to include the information on MDN to prevent further confusion.
Similarly, HTMLButtonElement: reportValidity() would benefit from further clarification, as given in HTMLFieldSetElement: reportValidity()
It always returns true because
<fieldset>elements are never candidates for constraint validation.
What did you expect to see?
A notice to say that method only produces a visual effect for button type="submit"
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
- Folder:
en-us/web/api/htmlbuttonelement/setcustomvalidity - MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/HTMLButtonElement/setCustomValidity
- GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/htmlbuttonelement/setcustomvalidity/index.md
- Last commit: https://github.com/mdn/content/commit/e9b6cd1b7fa8612257b72b2a85a96dd7d45c0200
- Document last modified: 2025-04-10T14:56:07.000Z