I'm setting custom validity using HTML5 Constraints API like this
inputElement.setCustomValidity('This is custom error message')
Then I'm trying to retrieve the value afterwards, but it's not present in any of ValidityState object fields when I'm listing them. It just sets customError to true, but the message is not in there.
How can I retrieve this message from the input element?
You can retrieve it with inputElement.validationMessage.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With