Hi I was able to get this working using below. The logic is very similar to yours.
#q9 and #q10 are id's of the email fields. I just took into consideration for initial situation where both fields are blank and the order in which the user fields in the fields.
$(document).ready(function(){
if(($('#q10 input').val()=='') && ($('#q9 input').val()=='')){
$('input[type="submit"]').hide();
}
$('#q9 input').on('change', function(){
if($('#q9 input').val() == $('#q10 input').val()){
$('input[type="submit"]').show();
}
if($('#q9 input').val() !== $('#q10 input').val()){
$('input[type="submit"]').hide();
}
});
$('#q10 input').on('change', function(){
if($('#q10 input').val() == $('#q9 input').val()){
$('input[type="submit"]').show();
}
if($('#q10 input').val() !== $('#q9 input').val()){
$('input[type="submit"]').hide();
}
});
});
Rather than hiding, you can also disable the buttons by using something like below:
$("#buttonActivate").prop("disabled", false);