Я пытаюсь отображать разные строки в зависимости от оценки после завершения викторины из 10 вопросов, но строки не отображаются. Я не уверен, где я ошибся с кодом: < /p>
Часть кода, которая добавляет строки: < /p>
$('.continue').on('click', function() {
populateQuestion(++currentQuestion);
$('#submit').prop('disabled', false);
if(currentQuestion === 10 && correctAnswers === 10){
$('.jumbotron').html('You got all 10 questions right! Way to go SUPER NERD!');
} else if(currentQuestion === 10 && correctAnswers >= 7){
$('.jumbotron').html('You got ' +correctAnswers+ " questions right! Don't get caught riding nerdy!");
} else if(currentQuestion === 10 && correctAnswers >= 5 ){
$('.jumbotron').html(correctAnswers + ' questions right? You could use a little more nerd in your life.');
} else if(currentQuestion === 10 && correctAnswers >= 3){
$('.jumbotron').html(correctAnswers + '? Wow, what\'s up preppy?');
} else if(currentQuestion === 10 && correctAnswers < 3){
$('.jumbotron').html(correctAnswers + ' for real? At least you got your name right....I hope');
}
});
< /code>
html is: < /p>
Click here to continue
...if you dare!
Я пытаюсь отображать разные строки в зависимости от оценки после завершения викторины из 10 вопросов, но строки не отображаются. Я не уверен, где я ошибся с кодом: < /p> Часть кода, которая добавляет строки: < /p> [code]$('.continue').on('click', function() { populateQuestion(++currentQuestion); $('#submit').prop('disabled', false); if(currentQuestion === 10 && correctAnswers === 10){ $('.jumbotron').html('You got all 10 questions right! Way to go SUPER NERD!'); } else if(currentQuestion === 10 && correctAnswers >= 7){ $('.jumbotron').html('You got ' +correctAnswers+ " questions right! Don't get caught riding nerdy!"); } else if(currentQuestion === 10 && correctAnswers >= 5 ){ $('.jumbotron').html(correctAnswers + ' questions right? You could use a little more nerd in your life.'); } else if(currentQuestion === 10 && correctAnswers >= 3){ $('.jumbotron').html(correctAnswers + '? Wow, what\'s up preppy?'); } else if(currentQuestion === 10 && correctAnswers < 3){ $('.jumbotron').html(correctAnswers + ' for real? At least you got your name right....I hope'); } }); < /code> html is: < /p>
Click here to continue
...if you dare!
[/code] Полный код находится на моем jsfiddle по адресу https://jsfiddle.net/ddeason37/ax8d3tc0/