Почему он работает? PrettyPrint-Override ">
Код: Выделить всё
const revealBtn = document.getElementById('reveal-btn')
const answer = document.getElementById('answer') //with a selected element
// without a selected 'question' element
revealBtn.addEventListener('click', function() {
answer.style.display = 'block'
question.style.backgroundColor = "#68e1fd" // this works without the 'question'
question.style.color = "#1434A4" // this works too
revealBtn.style.display = "none"
})
/*
Challenge
1. When the button is clicked and the answer revealed,
change the background color to #68e1fd and text color
to #1434A4 just in the "question" div.
2. When the answer is revealed, make the button disappear.
*/< /code>
.answer {
display: none;
}< /code>
Animal Trivia!
How many whiskers does the average rabbit have?
The average rabbit has 24 whiskers, 12 on each side!
Amazingly, no two whiskers are the same length!
Reveal Answer
Подробнее здесь: https://stackoverflow.com/questions/797 ... -the-eleme
Мобильная версия