DOM Properties
ValidityState.customError
True while a nonempty custom validity message is set. Clear it with an empty string when the problem is resolved, otherwise the control stays invalid. Example result: true.
Formal Syntax & Structure
html syntaxhtml
input.validity.customErrorReturn Value
boolean
Read-only constraint flag.
Working Example
Example Snippethtml
<input aria-label="Name"><p> Result: <output id="result"></output></p><script> const result = document.getElementById("result"); (async () => { const input = document.querySelector("input"); input.setCustomValidity("Choose another name"); result.textContent = input.validity.customError; })().catch(error => { result.textContent = "Error: " + error.name; });</script>