mdn/content

HTMLButtonElement - setCustomValidity(): Specify button type availability

Open

#42234 opened on Dec 4, 2025

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Markdown (8,900 stars) (22,427 forks)batch import
Content:WebAPIhelp wanted

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.

Ref: 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

Contributor guide