Create a Multiple Choice Quiz App Using JavaScript | JavaScript Project For Beginners

Поделиться
HTML-код
  • Опубликовано: 25 июл 2024
  • CODE EXPLAINED SAYS Hi!
    Today we're going to create a multiple choice quiz using JavaScript and HTML, in this quiz, the user will have to choose the correct answer out of three choices, in less than 10 seconds, if the user didn't answer the question in 10sec, it will go to the next question automatically, and the question is marked wrong. the user has a progress bar, that shows the total number of question, and also if the user answered a question correctly or not.
    The tutorial has two parts, the 1st part is about the logic behind the code, as we are not going directly to type in the code. And then the 2nd part where we will type in the code.
    If you want to follow along with me when I type in the code, you'll need to download the starter template from GitHub.
    -----------------------------------------------------------------------------------------------------
    | LINKS |
    -----------------------------------------------------------------------------------------------------
    DOWNLOAD SOURCE CODE + STARTER TEMPLATE:
    www.codeexplained.org/2018/10/...
    🌍 Social Media Links.
    ◾ Facebook : / code.explained.official
    ◾ Twitter : / code_explained
    ◾ Instagram : / code.explained.official
    ◾ GitHub : github.com/CodeExplainedRepo
    💲 Suppport the Channel
    Paypal : paypal.me/CodeExplained
    Buy Me a Coffee: www.buymeacoffee.com/CodeExpl...
    -----------------------------------------------------------------------------------------------------
    | HASH TAGS |
    -----------------------------------------------------------------------------------------------------
    #JavaScript #beginners #jstutorials

Комментарии • 201

  • @CodeExplained
    @CodeExplained  3 года назад +4

    💥 Hi everyone, thanks for watching and I hope you learnt a lot! Please remember to like and subscribe: cutt.ly/CodeExplained
    👊 Have a great day! and keep on learning.
    ☕️ If you feel that my videos help you, consider supporting me: www.paypal.me/CodeExplained 🙌

  • @hannahcarey7547
    @hannahcarey7547 2 года назад +4

    Thank you so much for showing the planning phase before coding and the connection between html elements and the JS. It's so useful for beginners who are in the process of building the image in their head and not able to make immediate connections between pieces of code. It's so rare to find this in code along tutorials so big props to you!

  • @osaretinmiller
    @osaretinmiller 8 месяцев назад +2

    Coming across this tut and it’s clinical explanation , I had no choice than to like and subscribe your channel. Please make more videos like this so we can become a pro like you. If possible create a forum where programmers like us can connect and build projects and learn from each other. Ty

  • @andrewrichard3490
    @andrewrichard3490 4 года назад +2

    One of the best coding tutorials ever. This visual learner's paradise really turbocharged my learning, especially of objects, where I was struggling. Thank you!

  • @ashleighfreiler3221
    @ashleighfreiler3221 3 года назад +6

    This is what I wish tutorials were actually like. Thank you for explaining instead of just doing with no understanding of why.

  • @robelseyoum1583
    @robelseyoum1583 5 лет назад +8

    Every JS videos you made are amazing, this one is the one of the great as well. Thanks!

  • @meloncholicbliss
    @meloncholicbliss 5 лет назад +22

    high quality production, very informative and calming voice. wish more people knew about you!

  • @katie-annfeatherstone7672
    @katie-annfeatherstone7672 4 года назад +7

    Fantastic Tutorial - really love the structure too. Great stuff! looking forward to making my own now :)

  • @genkihoshino1730
    @genkihoshino1730 4 года назад +1

    I couldn't learn programming without this channel! Thanks a lot

  • @muhammadrifky8541
    @muhammadrifky8541 5 лет назад +12

    what a nice channel, keep it up. never give up.
    this is a new style tutorial video on youtube

  • @yukselbey913
    @yukselbey913 5 лет назад

    Thanks a lot again. Your videos are very good. You are explaining all the details very well.

  • @TheLucidWay
    @TheLucidWay 4 года назад +20

    I really like how you break down the logic in every phase. I learned a lot with this video. Thanks for making it!

  • @abdelabdel8089
    @abdelabdel8089 5 лет назад

    Very, very and very good videos my friend. Please keep making them, you are helping us alot!

  • @christopherholt3782
    @christopherholt3782 2 года назад +1

    Love this channel. Super helpful, thanks a lot!
    ps I subbed

  • @arduinofoumelhisn2330
    @arduinofoumelhisn2330 5 лет назад +1

    Good! It works! Thanks.

  • @samluedde7491
    @samluedde7491 5 лет назад +6

    You are seriously amazing for this! You are an amazing teacher!!!

  • @codingislife6387
    @codingislife6387 Год назад

    Awesome Sir. May u live long . Thanks Sir. Very help ful

  • @wisamali2828
    @wisamali2828 4 года назад +1

    You're doing a great job ...Many thanks to you

  • @arturwenc5967
    @arturwenc5967 5 лет назад +2

    Great Video Thanks!

  • @codepirren2585
    @codepirren2585 5 лет назад

    Thanks! Great script!

  • @zeez6781
    @zeez6781 5 лет назад +1

    very helpful thank you kind sir

  • @claudialuciawerneck
    @claudialuciawerneck 5 лет назад +3

    Thanks a lot. Like Sam Luedde said, you are an amazing teacher.

  • @pascalcasier959
    @pascalcasier959 5 лет назад +1

    One of the best tutorial ! thank you so much.

  • @johnnyceballos3081
    @johnnyceballos3081 5 лет назад +3

    very clear tutorial. keep it up, sir! I hope to see more videos from you.

    • @CodeExplained
      @CodeExplained  5 лет назад +2

      Thank you, and of course you'll see more videos.

  • @aiasmarques1319
    @aiasmarques1319 4 года назад +2

    Really hard to know which is better: The tutorial or your explanation... Congratulations!

  • @arkadiuszbialak9217
    @arkadiuszbialak9217 5 лет назад

    A great post - very, very helpful. Thank you so much :-)

  • @sarojghising9877
    @sarojghising9877 5 лет назад

    great tutorials I appreciate way of u explained ... hands up thanks bro

  • @newsmix8659
    @newsmix8659 5 лет назад

    An excellent, informative and very useful project! keep up the good work!

  • @_myenglishbro
    @_myenglishbro Год назад

    I love this content

  • @pornjanatj5883
    @pornjanatj5883 3 года назад +1

    thank you so much for making this! I'm learning about coding now and your video is very useful.

  • @lodix-0
    @lodix-0 Год назад +1

    Very well explained,keep it up🔥🤝Ps:more videos on Js🙌

  • @wellingtoncardoso8585
    @wellingtoncardoso8585 5 лет назад

    Thank you very much to help!

  • @parasdesh
    @parasdesh 5 лет назад +1

    Thanks a lot friend.. It really help me in my project.

  • @techyworld3892
    @techyworld3892 3 года назад +1

    I like your way to explain JS code. Your videos are very good....🤓

  • @marcusramirez9848
    @marcusramirez9848 4 года назад

    This was so helpful, thanks!

    • @CodeExplained
      @CodeExplained  3 года назад +1

      I'm so glad to hear this from you, thanks a lot 💖

  • @pruebas4096
    @pruebas4096 3 года назад +1

    The Best teacher, thanks.

  • @chaoyingzeng2023
    @chaoyingzeng2023 4 года назад

    Thank you!👍

  • @neomusic8920
    @neomusic8920 4 года назад +1

    Very very very usefull!!!!! Thanks a lot of bro!

  • @ManojChauhan-kl3dh
    @ManojChauhan-kl3dh 3 года назад

    thanx bro it really helped me..!

  • @littlefraim
    @littlefraim 4 года назад

    Hi there:) Thank you for this great video! I have a question- if instead of questions I need to display video and instead of answers I need to display images. How should I do this?

  • @UPAyushFF
    @UPAyushFF 5 лет назад

    You are very good in explaining thanks

  • @tyebeach
    @tyebeach 5 лет назад

    I would like to have more in-depth information displayed after answering the question. How would I go about adding additional info after the question is answered?

  • @brightsideofmaths
    @brightsideofmaths 3 года назад +2

    Very nice video! I would like to use your code as a base to do quizzes for my videos. How do you prefer to get mentioned there? :)

    • @CodeExplained
      @CodeExplained  3 года назад +1

      Thanks.
      Yeah you can use any code you want.
      I don't know how, do what you can do.

    • @brightsideofmaths
      @brightsideofmaths 3 года назад +1

      @@CodeExplained Thank you :)

  • @gamingkingandqueen6659
    @gamingkingandqueen6659 3 года назад +1

    very helpful please make more video like these.

    • @CodeExplained
      @CodeExplained  3 года назад +1

      Happy it was helpful, And of course I will.

  • @animeshchakraborty9908
    @animeshchakraborty9908 4 года назад +1

    This is the best tutorial because of explanation.

  • @khizarali3286
    @khizarali3286 4 года назад

    Thanku soo much love u

  • @LinhPham-yf9nf
    @LinhPham-yf9nf 3 года назад

    Wow... That is, I call the tutor.. Thanks....

  • @syedmoon4488
    @syedmoon4488 4 года назад +1

    great work

  • @trangnguyenthibaotrang6944
    @trangnguyenthibaotrang6944 4 года назад

    Thank you so much 😍

  • @penge.shanghai
    @penge.shanghai 3 года назад +1

    You deserves the gold play button 💯🤓

  • @christianfernandez4143
    @christianfernandez4143 4 года назад +1

    Great explanation

  • @MrGdsuta
    @MrGdsuta 5 лет назад +1

    Awesome video! Thank you for uploading this. I just started to learn about web programming especially Java Script. I am a Physics teacher and I want to deliver my exam online so kids can do it at home. My idea is a multiple choice test with 5 answer options (A,B,C,D and E), maybe using radio button so the kids can change their answer if necessary, it also enables me to attach pictures on the questions or the answers (probably requires database system to store data), and it is being count-timed down let's say 90 minutes for one session. Once the time has finished, the test automatically submits the result. The kids can skip the questions they think is/are difficult and come back later (if they have time left). When they're done, they click finish button and get their instant score. The score and their answers report also being stored in database. Is there anyway you can help me making video tutorial how it can be done? :) Thank you!

    • @CodeExplained
      @CodeExplained  5 лет назад +1

      I can help, but I'm really busy for the moment. sorry

  • @MylesGmail
    @MylesGmail 5 лет назад +1

    thx i tweeted this n posted it on LinkedIn

  • @aquab8911
    @aquab8911 5 лет назад

    Hi, loved the tutorial, very helpful!
    I finished the tutorial but now I'd like to remove the pictures and the timer but when I do so my questions remain in the same position. I have the questions displaying one below the other. I'd like to now move them all the way to the left where the picture was or center them. Is this to do with the CSS? Thanks

  • @Reiziger-oj4zj
    @Reiziger-oj4zj 3 года назад

    What a fantastic tutorial! Thanks! Is it also possible to add some images to the questions in this multiple choise quiz?
    For example a bag of apples with 10 + 4 apples?

    • @CodeExplained
      @CodeExplained  3 года назад

      Thanks.
      And yeah of course you can achieve that.

  • @muayon-rm9ud
    @muayon-rm9ud 4 года назад

    A quick question can you reset the score when user plays the second game... right now, it counts out of 200% for the next game if you restart it. Thanks :)

  • @dragonarc_gaming
    @dragonarc_gaming 5 лет назад

    Thanks a lot, I'm trying to make a game similar to this so this really helps :)
    I can't show the smiley picture though for the score result and I'm not sure why :(

  • @bgrasta1048
    @bgrasta1048 Год назад

    is there a way to ask user to input new questions and answer and save it in the existing question array pool. can you shown me how i can do that, that will be helpful.

  • @ermiasabebe20
    @ermiasabebe20 4 года назад

    do you think i can add "play again" button and function it i try to solve it but i like to ask a posblity

  • @elvispresley355
    @elvispresley355 4 года назад +1

    Thanks for video, I loved it :D i wonder, is it possible to make different way for importing questions? Because it is quite impractical to add questions this way :S Let's say I want to make quiz with 1000, 2000 questions, how can i make it to import questions directly in app? Maybe in admin version or something like that? Once again, thanks for this tutorial, helped me a lot :)

    • @CodeExplained
      @CodeExplained  3 года назад +1

      I'm so glad to hear that from you, thanks a lot 💖

    • @CodeExplained
      @CodeExplained  3 года назад +1

      A JSON file will do the job.

  • @assisjunior4888
    @assisjunior4888 3 года назад

    TOP

  • @adrianandrews994
    @adrianandrews994 4 года назад

    Hey thank you so much this video has been such great help. How would the JS look if I wanted the timer to count down and for the user to get all remaining questions wrong once the time hits 0?

    • @adrianandrews994
      @adrianandrews994 4 года назад +1

      Just figured out how to get it to countdown

    • @CodeExplained
      @CodeExplained  4 года назад

      That's great!

    • @akiayoung9807
      @akiayoung9807 3 года назад

      @@adrianandrews994 Hi there! Im currently trying to figure this out. How did you accomplish this?

  • @safiya_zaheer
    @safiya_zaheer 4 года назад

    can you please make a video on how to make a feedback form in HTML and how to embed it on my website..

  • @ashutoshgavali9687
    @ashutoshgavali9687 4 года назад

    yes

  • @yukselbey913
    @yukselbey913 5 лет назад

    Thank You so much.

    • @CodeExplained
      @CodeExplained  5 лет назад +1

      You're welcome @yuksel_bey.
      The Tutorial was made especially for you!

    • @yukselbey913
      @yukselbey913 5 лет назад +1

      I know Thank you so much again. I have been waiting for it. I appreciated. You are explaining very well. I watched many videos your explanation is very well. Hard to find project base lessons like yours. I hope soon we can see your project base Javascript Lessons. Thanks a lot.

    • @CodeExplained
      @CodeExplained  5 лет назад

      Thank you as well. and of course I will make more tutorials :)

    • @yukselbey913
      @yukselbey913 5 лет назад

      It's hard to find project base HTML, CSS, and JavaScript lesson. I hope you can make a website with HTML, CSS, and JavaScript those maybe 10-15 lessons series. Kinda I want to make a website with HTML-CSS and Javascript. English is my 3rd language but your lesson-explanation is so clear. Thank you so much again.

    • @CodeExplained
      @CodeExplained  5 лет назад

      I have a lot of projects in mind, I just don't have enough time to do all of them, and keep in mind, that every single tutorial takes a lot of my time.

  • @calamity5543
    @calamity5543 3 года назад

    Great video, any ideas on how you can allow for 2 answers to be correct instead of just 1? tried using || and && but neither work xP

    • @CodeExplained
      @CodeExplained  3 года назад +1

      I think you need to put the answers inside an array, and loop through the array when checking for the right answer.

  • @alex07084
    @alex07084 4 года назад +2

    Hello sir
    You explain very well
    But I have one doubt
    How to insert image in place of text in choice

  • @goldy1894
    @goldy1894 4 года назад +1

    very good and helpful video. Just tried to remove the images and put my own, but it doesn't load them.

  • @siqnax
    @siqnax 3 года назад +1

    Hi bro, I like your tutorial.
    If I have thousands quiz,
    I would like to know how to create a randomly 20 questions,
    Thanks 👍

    • @CodeExplained
      @CodeExplained  3 года назад +1

      Happy to hear that, thanks 💖
      Use Math.random() to generate numbers from zero to 1000.

  • @freeyourmind7538
    @freeyourmind7538 Год назад

    3:00 Why do you use = document.getElementById(" ") and not = document.querySelector(" ").
    Is there a difference?

  • @nureenaqilah272
    @nureenaqilah272 4 года назад

    Hello, sorry to bother you but when i open it I get a box with 'start quiz!' inside it and clicking on it does nothing. In my apps, there is an error said "Passing error:the keyword 'const' is reserved". What should i do?

  • @ishop8330
    @ishop8330 3 года назад

    Which ide u are using here!? And thank u for this video

  • @pharmdnotes5575
    @pharmdnotes5575 4 года назад

    can you please explain how to export this quiz onto wix website

  • @fadifarid3699
    @fadifarid3699 5 лет назад +3

    In one word ....amazing
    But unfortunately I didn't understand it 100% , coz I am still beginner js and I have problem in parameters in function , can u give any advise in order to understand it 100% ?
    Again 10x 4 ur efforts

    • @CodeExplained
      @CodeExplained  5 лет назад +1

      Go w3schools.com and learn the basics about JavaScript Functions. Or you can watch one of my videos, that talks about them.

    • @fadifarid3699
      @fadifarid3699 5 лет назад +1

      I am apperciate ur efforts , but can u suggest to me any simple videos of yours
      Note: I am already understand the function but my problem is with the parameters inside it .

    • @CodeExplained
      @CodeExplained  5 лет назад

      Check my channel.

    • @NoOne-om9bb
      @NoOne-om9bb 5 лет назад

      Try newboston aswell

    • @fadifarid3699
      @fadifarid3699 5 лет назад

      @@NoOne-om9bb I don't understand what do u mean bro

  • @ManojChauhan-kl3dh
    @ManojChauhan-kl3dh 3 года назад

    cloud you please make tutorial series of java script by giving examples ...?

  • @christianlewis9359
    @christianlewis9359 4 года назад

    can anyone help me? how can i save the score to firestore database?

  • @saadahmad1257
    @saadahmad1257 5 лет назад

    Hello Prof @Code Explained, i wanna upgrade this app using the following features.
    time limit as a whole (not for a question)
    negative marking
    submit
    Will you pls tell me how can i do that?

    • @CodeExplained
      @CodeExplained  5 лет назад

      Did you figure out how to do that ?

    • @saadahmad1257
      @saadahmad1257 5 лет назад

      @@CodeExplained yup sir! I was using single qoute 😂😂

  • @kamilsayyed5493
    @kamilsayyed5493 4 года назад

    @codeexplained i am not getting the final percentage with image even after writing the same code...can you help me with that or explain why it is happening

  • @fantasyland7506
    @fantasyland7506 5 лет назад

    Thank you for the great tutorial I followed your steps but in min 33:40 document.getElementById(runningQuestion).style.backgroundColor
    I had error (Uncaught TypeError: Cannot read property 'style' of null)
    could you please help me

  • @RahulKumar-ic4xy
    @RahulKumar-ic4xy 2 года назад

    The only problem in this is Questions are already created.. I need an aap in which questions are not created before

  • @farajabbas7459
    @farajabbas7459 4 года назад

    Sir pls make some more videos !!!!!!

  • @Anonymous-zi5wr
    @Anonymous-zi5wr 3 месяца назад

    Why do you have multiple versions of this code? Your class names changed. Other things changed.

  • @meghnakanaujia7211
    @meghnakanaujia7211 4 года назад +1

    why is meta viewport tag not working in this code?

    • @CodeExplained
      @CodeExplained  4 года назад

      Are you 100% sure you really tried putting the following in your code?

  • @zuberjavedqureshi3320
    @zuberjavedqureshi3320 4 года назад

    Can you make video on same quiz. But with the jquery?

  • @freshlearnerstamil296
    @freshlearnerstamil296 4 года назад

    Hey man I have a error in renderprogress function

  • @nivedhidhaeswar4291
    @nivedhidhaeswar4291 3 года назад +1

    But I have a 2 correct answers and 2 wrong answers...which condition I have used?

  • @mayorca_institute
    @mayorca_institute 3 года назад

    The progress bar is not working in my js file, the timer is not responding too.... What's the problem

  • @codingislife6387
    @codingislife6387 Год назад

    Sir Please Make Wish_List using JS

    • @codingislife6387
      @codingislife6387 Год назад

      1st add wishlist __ moving Wishlist to Cart item...???

  • @consultajonathan3468
    @consultajonathan3468 4 года назад +1

    Your code doesnt work on phone if I press start quiz

  • @chickeninvider
    @chickeninvider 5 лет назад

    I can't add more than 7 questions. is there a limit?

    • @CodeExplained
      @CodeExplained  5 лет назад +1

      No you can add as many questions as you want.

    • @chickeninvider
      @chickeninvider 5 лет назад +1

      Code Explained nermind im just stupid

  • @AmirHamzaPKP
    @AmirHamzaPKP 4 года назад

    The effort is really good. But the code is not responsive. It should be written in such a way that it should be responsive.

    • @CodeExplained
      @CodeExplained  4 года назад

      Sorry for that It's a JavaScript tutorial not CSS.

  • @AB-vm9gk
    @AB-vm9gk 4 года назад

    Hello, sorry to bother you but I am not sure what I've done wrong. I typed what you did (letter for letter and have checked about 5 times!) and it doesn't work - when i open it I get a box with 'start quiz!' inside it and clicking on it does nothing. any idea what I've done wrong as I can't seem to find anywhere that I have written something different than you??

    • @CodeExplained
      @CodeExplained  4 года назад +1

      When you click on it. does something shows up in the console?

    • @AB-vm9gk
      @AB-vm9gk 4 года назад +2

      @@CodeExplained no, nothing happens at all except the outline of the box changes colour from green to grey

    • @ladiran
      @ladiran 3 года назад +1

      Exactly same problem here!
      I have looked at all I could, made all the corrections I understood, yet nothing is showing.
      I checked my browser if JavaScript is enabled and YES, it is but it seems this JavaScript is just not running.

    • @ladiran
      @ladiran 3 года назад +1

      I finally figured it out and its working now. Here is what I did:
      Under "//create our questions", I commented-out " const question=document.getElememtById("question");"
      Then under "//create our questions", I changed " let question = ..." to "const questions = ...".
      And that's all, everything works fine after that!

  • @freshlearnerstamil296
    @freshlearnerstamil296 4 года назад

    Its not creating the circles for the 3 questions

  • @derp2724
    @derp2724 5 лет назад

    are you using notepad??

  • @user-do1oe7id7o
    @user-do1oe7id7o 4 года назад +1

    imgSrc dosent seems to work

    • @user-do1oe7id7o
      @user-do1oe7id7o 4 года назад

      it says unexpected token imgSrc

    • @CodeExplained
      @CodeExplained  4 года назад

      Unexpected Token errors are a subset of SyntaxErrors and, thus, will only appear when attempting to execute code that has an extra (or missing) character in the syntax, different from what JavaScript expects

  • @zakwanmasud2406
    @zakwanmasud2406 5 лет назад

    plz modify it and make it responsive.

  • @Kuraudo-Ooishi
    @Kuraudo-Ooishi 4 года назад

  • @farajabbas7459
    @farajabbas7459 4 года назад

    Please 😖😖😖😖

  • @alex07084
    @alex07084 4 года назад +1

    Hello sir
    You explain very well
    But I have one doubt
    How to insert image in place of text in choice

    • @CodeExplained
      @CodeExplained  4 года назад

      Just some little changes and you'll get what you want.

  • @alex07084
    @alex07084 4 года назад

    Hello sir
    You explain very well
    But I have one doubt
    How to insert image in place of text in choice

    • @CodeExplained
      @CodeExplained  4 года назад

      Little changes in your code and you'll do it.