mdn/content

HTMLButtonElement - setCustomValidity(): Specify button type availability

Open

#42 234 ouverte le 4 déc. 2025

Voir sur GitHub
 (3 commentaires) (0 réactions) (0 assignés)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

Guide contributeur