I have a question and answer section of my jQuery mobile site, where the user is asked 6 questions of out 40 possible questions. There are set answers for each one, but there isn’t a correct answer. How do I randomize this in Javascript so that the same questions aren’t always asked? The user will select an answer and then click next to go to the next question. I only want one question to show at a time. There is one question per page, and I want the question to be in the h2 tag and the answers in each div , like below:
<h2>What is the weather like today?</h2>
<div class="answers">
<div class="answers-left">
<div class="answer1" tabIndex="1">Sunny</div>
<div class="answer2" tabIndex="2">Raining</div>
</div>
<div class="answers-right">
<div class="answer3" tabIndex="3">Cloudy</div>
<div class="answer4" tabIndex="4">Windy</div>
</div>
<div class="clear"></div>
</div>
<div class="next-button">
<a class="ui-btn" href="question-2.html" rel="external">Next</a>
</div>
Another way I was thinking was to create a multipage in jQuery and have 40 pages inside, one for each question, then create a function that randomizes the pages and the user is only shown 6 when pressing next. Is there a better way of doing this than I am proposing?