I was able to piece together the following code.
In addition to setting Focus values (each fillable field value is scanned), it checks the values of #q2, #q3, #q4 to see if #q3 and #q4 matches #q2. If they all do NOT match then #q5 (html field) is shown. I am trying to also add the code to hide the submit button along with showing the HTML alert field - #q5.
Thus far my attempts have failed.
Any help would be appreciated.
$(document).ready(function() {
$('#q1 input').focus(); // Trigger focus on the input field inside #q1
$('#q1 input').keyup(function() {
setTimeout(function() {
if ($('#q1 input').val().length > 0) {
$('#q3 input').focus();
}
}, 500); // Wait for 0.5 seconds before moving focus
});
$('#q3 input').keyup(function() {
setTimeout(function() {
if ($('#q3 input').val().length > 0) {
$('#q4 input').focus();
}
}, 500); // Wait for 0.5 seconds before moving focus
});
$("#q5").hide();
$("#q2 input, #q3 input, #q4 input").change(function(){
if ($("#q2 input").val() != $("#q3 input").val() && $("#q3 input").val() != '') {
$("#q5").show();
}
else if ($("#q2 input").val() != $("#q4 input").val() && $("#q4 input").val() != '') {
$("#q5").show();
}
else {
$("#q5").hide();
}
});
});