I run a dynamic quiz website using PHP, JavaScript, and MySQL. The quiz consists of multiple choice questions with answer options displayed on four buttons.
<input type = "button" value="$alt1" onClick="changeQuestion('alternative1'); this.style.backgroundColor = '#A9A9A9'">
I am looking for a solution to prevent users from clicking multiple answer buttons before the JavaScript function completes its execution. This behavior currently causes issues with the quiz results.
The onclick event triggers a JavaScript function that uses AJAX to communicate with a PHP file responsible for processing the chosen answer.
Thank you in advance for your help!