Skip to content

Instantly share code, notes, and snippets.

@rodica-andronache
Created February 3, 2014 19:31
Show Gist options
  • Select an option

  • Save rodica-andronache/8790696 to your computer and use it in GitHub Desktop.

Select an option

Save rodica-andronache/8790696 to your computer and use it in GitHub Desktop.
Change default error message "Please fill out the field"
jQuery(function() {
var intputElements = document.getElementsByTagName("INPUT");
for (var i = 0; i < intputElements.length; i++) {
intputElements[i].oninvalid = function (e) {
e.target.setCustomValidity("");
if (!e.target.validity.valid) {
if (e.target.name == "my-email") {
e.target.setCustomValidity("Va rugam completati adresa de email!");
}
else if(e.target.name == "my-password") {
e.target.setCustomValidity("Va rugam completati parola!");
}
else {
e.target.setCustomValidity("Va rugam completati campul!");
}
}
};
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment