by
0 11
0
3
2,565
2
Top 1% !
Famous
Specified
Popularity: 6735th place
No tags for this snippet yet.
LanguageJavaScript
SourceGitHub

custom validation email input message

custom validation email input message: 
meh.js
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1111817/custom-validation-email-input-message?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
[].forEach.call( document.querySelectorAll('[type="email"]'), function(emailElement) { emailElement.addEventListener('invalid', function() { var message = this.value + 'is not a valid email address'; emailElement.setCustomValidity(message) }, false); emailElement.addEventListener('input', function() { try{emailElement.setCustomValidity('')}catch(e){} }, false); });
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus