My goal is to develop a system that increments the 'fault' counter by one every time a wrong answer is submitted. To achieve this, I have configured my system to detect when a class named "incorrectResponse" is generated. However, I am encountering an issue where the counter only increases upon page load and does not update afterwards.
Below is the code snippet that I have attempted but hasn't been successful:
//*-- Fault counter --*//
if (document.querySelectorAll('incorrectResponse')) {
$('#fault-counter').html(function(i, val) { return val*1+1 });
};
Can anyone shed light on why this behavior is occurring?