Created
February 3, 2014 19:31
-
-
Save rodica-andronache/8790696 to your computer and use it in GitHub Desktop.
Change default error message "Please fill out the field"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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