docs / articles / Simple Quiz with HTML: Easy Creation Guide

Simple Quiz with HTML: Easy Creation Guide

Eric Jul 09, 2026 2026-07-09 04:40:47

Creating a simple quiz using HTML can be an engaging way to test knowledge or gather feedback. With basic HTML, CSS, and a bit of JavaScript, you can create an interactive quiz that's both functional and visually appealing.

my first quiz!!!!
my first quiz!!!!

Before diving into the code, let's outline the structure of our simple quiz. We'll need a title, questions, answer choices, and a way to submit and check the answers. We'll also include a score tracker to provide instant feedback to the user.

Are you annoying?
Are you annoying?

Setting Up the Quiz Structure

Start by creating the basic structure of your quiz using HTML. You'll need a form to wrap your questions and answers, and labels and inputs for each question and answer choice.

are cute or hot quiz ʕ⁠っ⁠•⁠ᴥ⁠•⁠ʔ⁠っ
are cute or hot quiz ʕ⁠っ⁠•⁠ᴥ⁠•⁠ʔ⁠っ

Here's a simple example to get you started:

```html

Simple Quiz

how fucked up are you? quiz
how fucked up are you? quiz

```

Creating Multiple Choice Questions

In the example above, we've created a multiple choice question. Each question should have a unique id and name, and the answer choices should have the same name as the question.

To create more questions, simply repeat the label and input structure, changing the id and name attributes for each question and answer choice.

are you hot, cute, or pretty?
are you hot, cute, or pretty?

Adding a Score Tracker

To keep track of the user's score, you can add a variable that increments each time the user selects the correct answer. You can display this score in real-time using JavaScript.

Here's an example of how you might initialize the score variable and display it on the page:

How alike are we quiz🌷
How alike are we quiz🌷

```html

Score: 0

```

Making the Quiz Interactive with JavaScript

what group would you be in at my school??
what group would you be in at my school??
do my quiz
do my quiz
Are u an A type, mean girl/boy, weird, nerd or..... Personality Quizzes Mbti, Personality Ideas Character, Quiz About Me Questions, Personality Types Quiz, How To Have A Personality, Types Of Personality, Mbti Personality Quiz, Who Am I Quiz Questions, What Personality Type Am I Quiz
Are u an A type, mean girl/boy, weird, nerd or..... Personality Quizzes Mbti, Personality Ideas Character, Quiz About Me Questions, Personality Types Quiz, How To Have A Personality, Types Of Personality, Mbti Personality Quiz, Who Am I Quiz Questions, What Personality Type Am I Quiz
hmm?
hmm?
got bored, made a quiz.
got bored, made a quiz.
Gay uquiz
Gay uquiz
How gay are you
How gay are you
Are you in love? <3
Are you in love? <3
how dirty is you mind
how dirty is you mind
just a brief one.
just a brief one.
Can I guess ur age?
Can I guess ur age?
let's see which flag you are!
let's see which flag you are!
what colour do you represent?
what colour do you represent?
What's your sexuality?
What's your sexuality?
let me guess ur age guys plssss click to take
let me guess ur age guys plssss click to take
take the QUIZ!!!!!!!!!!!!
take the QUIZ!!!!!!!!!!!!
GO TAKE MY FORM 👅
GO TAKE MY FORM 👅
Please take my Google Form!
Please take my Google Form!
quiz made by @aestheticlittlemess on pinterest || tell me what you get in the comments
quiz made by @aestheticlittlemess on pinterest || tell me what you get in the comments
take this quiz❤️❤️❤️
take this quiz❤️❤️❤️

JavaScript is essential for making your quiz interactive. You'll use it to check the user's answers, update the score, and provide feedback.

First, add an event listener to the form's submit event. This will trigger when the user submits their answers:

```html ```

Checking the Answers

Inside the event listener, you can loop through each question and check if the selected answer matches the correct answer. You can store the correct answers in an array or object for easy reference.

Here's an example of how you might check the answers:

```html let correctAnswers = ['b', 'c', 'a']; // Replace with your correct answers let score = 0; for (let i = 1; i <= 3; i++) { // Assuming 3 questions let selectedAnswer = document.querySelector(`input[name="q${i}"]:checked`).value; if (selectedAnswer === correctAnswers[i - 1]) { score++; } } ```

Updating the Score and Providing Feedback

After checking the answers, you can update the score and provide feedback to the user. You can display a message indicating whether they got the question right or wrong, and update the score display.

Here's an example of how you might do this:

```html document.getElementById('score').innerText = `Score: ${score}`; alert(`You got ${score} out of 3 correct!`); ```

With these steps, you've created a simple, interactive quiz using HTML and JavaScript. You can further customize the quiz by adding CSS for styling, or incorporating more complex JavaScript functionality like question randomization or timer.

Now that you've created your quiz, why not share it with friends or colleagues to test their knowledge? Happy coding!