I am hoping that I can easily randomize the order of these answers without redoing a lot of code. The problem is that I am putting each question from an XML file into an array (this block of XML includes the answers). In hind sight it would have been better if I had put each anser into it's own array. In the jQuery '.each' loop below I was hoping I could do something to randomize the list of answers. I am including the XML structure.
Any help would be greatly appreciated.
//***** Loop through the array, display each answer, store the correct answer for comparison later *********/
$("#kc_answers").append('<li><label><input type="radio" name="example1" /><span class="kc_answer_span">' + $(this).find('aText').text() + '</span></label></li>');
if($(this).attr('correct') == 'true')
correctAnswer = $(this).find('aText').text();
//***** Store each question block seperately in the question array. ********/
//***** Randomize the questions. ********/
for(var j, x, i = questionArr.length; i; j = parseInt(Math.random() * i), x = questionArr[--i], questionArr[i] = questionArr[j], questionArr[j] = x);
<qText>(U) What is the meaning of this?</qText>