spbooks / jsninja1

Code archive for the book JavaScript: Novice to Ninja
176 stars 135 forks source link

Questions aren't displayed #2

Open jonaspau opened 8 years ago

jonaspau commented 8 years ago

Hi,

In chapter 6, the quiz seems to have an issue:

After trying this challenge and not getting the questions right i looked through the files and found no errors in what I'd done.

I then tried cloning this repository and get the same error here as well. the score is not updated either, until game over.

daz4126 commented 8 years ago

Hi Jonas,

Sorry to hear that you've been having some difficulties.

It does work, but the prompt obscures the question ... so it's not very functional as a quiz!

You can tell it's working by changing the 'ask' function to the following:

function ask(question) { update($question,quiz.question + question); alert($question.firstChild.textContent); return prompt("Enter your answer:"); }

This will alert the content of the $question element and prove that it is actually being updated, the problem is that you can't see it in the window.

This all gets sorted out in the next chapter when we stop using prompts to enter the answers, so I encourage you to press on!

Hope that helps,

DAZ

baller4lyfe commented 7 years ago

I had the same issue as well @jonaspau. While using Chrome I noticed the DOM updates were not as I expected. Mozilla Firefox though works just fine. As @daz4126 says the code is fine, it just seems to be an issue with how different browsers handle the alert dialog.

daz4126 commented 7 years ago

I'm currently updating the book so will try and get this to work better. Thanks to you both for your feedback.