본문 바로가기

Dev/JavaScript17

[JavaScript] Momentum App - 4.1 ToDo-List Deleting To Dos // 삭제 버튼 만들기 const toDoForm = document.getElementById("todo-form"); const toDoInput = document.querySelector("#todo-form input"); const toDoList = document.getElementById("todo-list"); function deleteToDo(event){ //target은 눌린 button - 부모 요소는 li -> 삭제 대상 const li = event.target.parentElement; li.remove(); // 삭제 } function paintToDo(newTodo){ const li = document.createElement("li"); const span = d.. 2022. 5. 2.
[JavaScript] Momentum App - 3. Quotes and Background // quotes.js const quotes = [ { quote: "Love For All, Hatred For None.", author: "Khalifatul Masih III" }, { quote: "Change the world by being yourself.", author: "Amy Poehler" }, { quote: "Every moment is a fresh beginning.", author: "T.S Eliot" }, { quote: "Never regret anything that made you smile.", author: "Mark Twain" }, { quote: "I don’t need it to be easy, I need it to be worth it. ", au.. 2022. 5. 2.
[JavaScript] Momentum App - 2.Clock // setInterval() const clock = document.querySelector("h2#clock"); function sayHello() { console.log("hello"); } //interval ex) 매 2초 마다 작동해야함 //setInterval(실행하고자 하는 function, 몇 ms마다 호출할 건지) setInterval(sayHello, 5000);// 5초마다 sayHello 호출 // getClock() const clock = document.querySelector("h2#clock"); function getClock(){ const date = new Date(); clock.innerText = `${date.getHours()}:${date.getMi.. 2022. 5. 2.
[JavaScript]Momentum App - 1.Login - Saving Username https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage Window.localStorage - Web APIs | MDN The localStorage read-only property of the window interface allows you to access a Storage object for the Document's origin; the stored data is saved across browser sessions. developer.mozilla.org 저장공간 = localStorage const loginForm = document.querySelector("#login-form"); const loginInput =.. 2022. 4. 28.