Request Dev Services ยป

theDevTip.com

Create a ‘Dynamic’ JavaScript web-quiz (MC w/ feedback)!

In this demo, I’ll use JavaScript and jQuery to put together a dynamic ‘survey-style-quiz’ questionnaire type thinga mahjig. Questions will appear one at a time allowing the user to select a multiple choice answer.. at the end; the correct answers will be tallied!


So, essentially

var questions = [{
    question: "Have you ever used the AJAX?! If so, how many times?",
    choices: [2, 5, 10, 15, 20],
    correctAnswer: 2
  }, {
    question: "SASS is a Microsoft product right? Approximately how many years have you coded inside the SASS?",
    choices: [3, 6, 9, 12, 18],
    correctAnswer: 6
  }, {
    question: "What about ANGULAR? How many years did you code at an acute Angle? ..don't lie...",
    choices: [72, 99, 108, 134, 156],
    correctAnswer: 156
  }, {
    question: "How many times have you seen the inside of THE DOM?! .. ballpark?",
    choices: [4, 5, 6, 7, 8],
    correctAnswer: 5
  }, {
    question: "How many times a day are you willing to hop on a CHAT CALL with me?",
    choices: [20, 30, 40, 50, 64],
    correctAnswer: 64
  }];

Today’s context

[ Full CodePen Demo! ]


See the Pen Dynamic JS Quiz by Cameron (@camerondevcam) on CodePen.


About the Author
Cameron Cashwell Web Developer
I build websites, web apps, and software. Wanna work together? Let's chat about your project!

Leave a Reply

avatar
  Subscribe  
Notify of