3

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?

1 Answer 1

11

You can retrieve it with inputElement.validationMessage.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.