My challenge involves utilizing a JQuery file to present one question at a time in a quiz format. Upon clicking the submit button, the intention is to progress to the subsequent question. However, I have encountered an issue where the transition occurs momentarily upon button press before reverting back to the initial question.
The code snippet I am working with is outlined below:
$(document).ready(function() {
"use strict";
// jQuery logic for each question
$('button#FlexibilityNext01').click(function() {
$('#FlexibilityQ01').css({'display':'none'});
$('#FlexibilityQ02').css({'display':'block'});
});
// Similar logic for Questions 02 through 09
// Handling final question and retake option
$('button#FlexibilityFinishQuiz').click(function() {
$('#FlexibilityQ10').css({'display':'none'});
$('#RetakeQuiz').css({'display':'block'});
});
$('#FlexibilityRetakeQuiz').click(function() {
$('#FlexibilityRetakeQuiz').css({'display':'none'});
$('#FlexibilityQ01').css({'display':'block'});
});
});
<div class="Question" id="FlexibilityQ01">
<form id="FlexibilityFormQ01">
<!-- form question here -->
<button type="submit" id="FlexibilityNext01">Next Question</button>
</form>
</div> <!-- class="Question" id="Q1" -->
<!-- HTML markup for questions 02-10 follows similar structure -->
I have attempted various display manipulation methods such as hiding/showing elements and changing CSS properties using both `$('#id')` and `$("#id")`, but all seem to manifest the same issue.