I have a quiz, and i need to add some validation to a confirm email address
field, basically it just has to match the email address given in the above field. I am using the following javascript, can i add something in here which will make sure the emails match?
if ($('#mtQuiz').length > 0) {
$('#myQuiz').validate({
errorElement: "em",
errorContainer: $("#warning"),
rules: {
'entry[first_name]': 'required',
'entry[last_name]': 'required',
'entry[email]': {
required: true,
email: true
},
'entry[confirm_email]': {
required: true,
email: true
}
},
messages: {
'entry[first_name]': 'Please enter first name',
'entry[last_name]': 'Please enter last name',
'entry[email]': {
required: ' Please enter a valid email address',
minlength: 'Not a valid email address'
},
'entry[confirm_email]': {
required: ' Please make sure email matches above',
minlength: 'Does not match above email address'
}
}
});
}
See Question&Answers more detail:os