scrimba
Note at 0:48
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Note at 0:48
AboutCommentsNotes
Note at 0:48
Expand for more info
index.js
run
preview
console
const greeting = document.getElementById("greeting")
const christmassifierBtn = document.getElementById("christmassifierBtn")
christmassifierBtn.addEventListener("click", christmassifyName)
document.body.style.backgroundColor = "gray";
christmassifierBtn.style.backgroundColor = "black";

function christmassifyName() {
// Task:
greeting.classList.toggle("christmassified");
christmassifierBtn.classList.toggle("christmassified");

if(christmassifierBtn.classList.contains("christmassified")){
christmassifierBtn.innerHTML = "De-Christmassify";
christmassifierBtn.style.color = "white";
document.body.style.backgroundImage = "url(https://i.giphy.com/media/WWNObA6zP3wNZBYWlU/giphy.webp)";
christmassifierBtn.style.backgroundColor = "red";
}else{
christmassifierBtn.innerHTML = "Christmassify";
document.body.style.backgroundImage = "";
document.body.style.backgroundColor = "gray";
christmassifierBtn.style.backgroundColor = "black";
}



}



// Stretch goals:
// - Play Christmas music when Christmas class is added.
// - Remove the Christmas class after a given time.

Console
/index.html
LIVE