I have the same issue but with telephone numbers. Like others, I found the code (and modified it for my needs), placing it in my custom javascript for that form :
$(function(){
// check for matching phone numbers
$('form.appnitro').submit(function() {
if($("#element_8").val() != $("#element_9").val()){
$("#element_9").parentsUntil("ul").last().addClass("error");
if ($("#element_9").parentsUntil("ul").last().children().last().html() != 'Matching phone number required'){
$("#element_9").parentsUntil("ul").last().append('<p class="error">Matching phone number required</p>');
}
//restore the submit button
$("#li_buttons > input[type=submit],#li_buttons > input[type=image]").prop("disabled",false);
//cancel the form submission
return false;
}
});
});
So it checks that 2 elements are the same, but with the modification that if the number is repeatedly entered incorrectly it doesn't continue appending the error message.
However like @williamansley mentions above it isn't the best solution as it doesn't process any other changes in the form at the same time. Another vote for a cleaner solution to custom form verification.