Help with js/jquery quiz

  • Started
  • Last post
  • 2 Responses
  • caoimh

    Hi, I am having trouble with coding a quiz whereby each question has a number of checkboxed answers. Some questions require that two or more checkboxes are checked. Then each question has a sbmit button to check if you've got it right otherwise try again. Any takers?

  • acescence0

    store the answers in an array of arrays, create an on submit function that gathers the checked values and matches against members/length of that question's answer array

  • LarryBattle0

    Try jQuizMe.
    I wrote and it solves a lot of problem with creating online quizzes.
    http://code.google.com/p/jquizme…

    Hey Caoimh,
    If you don't know want use jQuizMe then do this.
    Note: This is assuming the checkbox positions are not randomized,

    - Make the answer to each questions, a letter. If multiple answer combine the letter with a "-".
    - Name each question's answer selection checkbox in alphabethical order.
    - Once the sumbit button is clicked, you call a functions that get's the names of the checked checkboxes and joins it into a string.

    So this way all the answers are strings.
    ques[ quesindex ].ans = "A"; // one answer.
    ques[ quesIndex ].ans = "A-B"; //multiple answers.