Last active
November 2, 2018 19:30
-
-
Save acflint/9c830990d81a998c3708cd1018f9cfd0 to your computer and use it in GitHub Desktop.
Javascript to replace Nationbuilder form errors
This file contains 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
<!-- add to any page in your Nationbuilder theme where there's a form and you want to update the error messages. --> | |
<script language="JavaScript"> | |
$(document).ajaxComplete(function(event, request, settings) { | |
// this would replace any error message that contains 'Email' with 'Le courriel doit ètre remplie' | |
$(".form-errors ul li:contains('Email')").text('Le courriel doit ètre remplie'); | |
// this would replace any error message that contains ‘First name' with 'Le prénom doit ètre remplie' | |
$(".form-errors ul li:contains('First name')").text('Le prénom doit ètre remplie'); | |
// this would replace any error message that contains ‘Last name' with 'Le nom doit ètre remplie' | |
$(".form-errors ul li:contains('Last name')").text('Le nom doit ètre remplie'); | |
// you can duplicate as many times as needed, for each error message that you want to translate. | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice Alex! Just seeing this now -- yes. Much improved than my hacky script haha