refactor js

begin building out script with separate
functions with specific behavior
account for note needing to be interacted with
first before other items can be clicked on
This commit is contained in:
emma 2025-02-02 08:08:08 -05:00
parent ddfb3da84a
commit d9c007e206
1 changed files with 11 additions and 4 deletions

View File

@ -13,10 +13,17 @@ const notesForEmma = {
tileTwelve: "person",
};
const note = document.querySelector(".read-this");
const tiles = document.querySelectorAll(".tile");
tiles.forEach((el) => {
el.addEventListener("click", () => {
console.log(`${notesForEmma[el.className.split(' ')[0]]}`);
note.addEventListener("click", () => {
tiles.forEach((el) => {
el.addEventListener("click", () => {
displayNote(el);
});
});
});
});
const displayNote = (noteName) => {
console.log(`${notesForEmma[noteName.className.split(' ')[0]]}`);
};