changing the language of error message in required field in html5 contact form

setCustomValidity‘s purpose is not just to set the validation message, it itself marks the field as invalid. It allows you to write custom validation checks which aren’t natively supported.

You have two possible ways to set a custom message, an easy one that does not involve Javascript and one that does.

The easiest way is to simply use the title attribute on the input element – its content is displayed together with the standard browser message.

<input type="text" required title="Lütfen işaretli yerleri doldurunuz" />

enter image description here

If you want only your custom message to be displayed, a bit of Javascript is required. I have provided both examples for you in this fiddle.

Leave a Comment