Sometimes, we want to change or remove HTML5 form validation default error messages.
In this article, we’ll look at how to change or remove HTML5 form validation default error messages.
How to change or remove HTML5 form validation default error messages?
To change or remove HTML5 form validation default error messages, we set the pattern
and title
attributes.
For instance, we write
<input
type="text"
pattern="[a-zA-Z]+"
title="Please enter Alphabets."
required=""
/>
to set the pattern attribute to the regex pattern that we want to check the input value for.
And we set the title attribute to the validation message.
Conclusion
To change or remove HTML5 form validation default error messages, we set the pattern
and title
attributes.