scrimba
JS Deep Dive
Google Keep
Google Keep - Storing Notes in the App
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

Google Keep - Storing Notes in the App
AboutCommentsNotes
Google Keep - Storing Notes in the App
Expand for more info
app.js
run
preview
console
class App {
constructor() {
this.$form = document.querySelector("#form");
this.$noteTitle = document.querySelector("#note-title");
this.$formButtons = document.querySelector("#form-buttons");

this.addEventListeners();
}

addEventListeners() {
document.body.addEventListener("click", event => {
this.handleFormClick(event);
});
}

handleFormClick(event) {
const isFormClicked = this.$form.contains(event.target);

if (isFormClicked) {
this.openForm();
} else {
this.closeForm();
}
}

openForm() {
this.$form.classList.add("form-open");
this.$noteTitle.style.display = "block";
this.$formButtons.style.display = "block";
}

closeForm() {
this.$form.classList.remove("form-open");
this.$noteTitle.style.display = "none";
this.$formButtons.style.display = "none";
}
}

new App();
Console
/index.html
-9:23