2

How do you change the language of the default error message you get with type="email"?

  • 1
    Possible duplicate of [changing the language of error message in required field in html5 contact form](http://stackoverflow.com/questions/10753881/changing-the-language-of-error-message-in-required-field-in-html5-contact-form) – Steven B. Jul 26 '16 at 14:52

2 Answers2

2

You can use HTML oninvalid Event Attribute

<form>
<input type="email"  required oninvalid="this.setCustomValidity('Por favor, introduce una dirección de correo electrónico válida')"/>
<input type="submit"/>
</form>

Result

enter image description here

Raman Sahasi
  • 30,180
  • 9
  • 58
  • 71
0

If you only will your Message then use this:

$('#text').on('change invalid', function() {
     this.setCustomValidity('Your message');  
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
    <input id="text" type="text" required />
    <input type="submit">
</form>
leona
  • 423
  • 3
  • 16