diff --git a/README.md b/README.md index 98e7dfae..dda34f7e 100644 --- a/README.md +++ b/README.md @@ -244,3 +244,11 @@ live-server 폴더λͺ… ## πŸ“ License This project is [MIT](https://github.com/blackcoffee-study/moonbucks-menu/blob/main/LICENSE) licensed. + +# νŒ€μ΄λ¦„: N^6 +- 김성쀑 +- κΉ€λ™μš± +- μ •μš”ν•œ +- μ •μƒˆλ―Έ +- μ „μƒν˜ +- μ„œμ§„κ·œ \ No newline at end of file diff --git a/index.html b/index.html index ebac1c4c..375cdb32 100644 --- a/index.html +++ b/index.html @@ -69,7 +69,7 @@

β˜• μ—μŠ€ν”„λ ˆμ†Œ 메뉴 관리

autocomplete="off" /> + + ` + }; + + const removeMenuName = (e) => { + e.target.closest("li").remove(); + updateMenuCount(); + }; + + const editMenuName = (e) =>{ + const $menuName = e.target.closest("li").querySelector(".menu-name"); + const editedName = prompt("메뉴λͺ…을 μˆ˜μ •ν•˜μ„Έμš”", $menuName.textContent); + if(!editedName) return; + $menuName.textContent = editedName; + }; + + $("#espresso-menu-list").addEventListener("click", (e) => { + if (e.target.classList.contains("menu-edit-button")){ + editMenuName(e); + } + + if(e.target.classList.contains("menu-remove-button")){ + if(confirm("정말 μ‚­μ œν•˜μ‹œκ² μŠ΅λ‹ˆκΉŒ?")){ + removeMenuName(e); + } + } + }); + + // form νƒœκ·Έκ°€ μžλ™μœΌλ‘œ μ „μ†‘λ˜λŠ” κ±Έ 막기 + $("#espresso-menu-form").addEventListener("submit", (e) => { + e.preventDefault(); + createMenuName(); + }) + + // $("#espresso-menu-name").addEventListener("keydown", (e) => { + // if(e.key !== "Enter") return; + // createMenuName(); + // }); + + // $("#espresso-menu-submit-button").addEventListener("click", createMenuName); + +} + +App(); \ No newline at end of file