Set custom validation message for HTML5 form required attribute.

Hi,
Set custom validation message for HTML5 form required attribute using the DOM function setCustomValidity . Please go through following example.

<input type="text" name="Username" id="Username" required="required" oninvalid="this.setCustomValidity('Username cannot be empty.')" />

Screenshot :

manukeerampanal

Leave a Reply