Написание .html () с определенными условиямиJquery

Программирование на jquery
Anonymous
Написание .html () с определенными условиями

Сообщение Anonymous »

Я пытаюсь отображать разные строки в зависимости от оценки после завершения викторины из 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!

Полный код находится на моем jsfiddle по адресу https://jsfiddle.net/ddeason37/ax8d3tc0/

Подробнее здесь: https://stackoverflow.com/questions/342 ... nditionals

Вернуться в «Jquery»