JavaScript/PairProgramming1 회고
Toast
해당 포스트는 제로베이스 오프라인스쿨 진행 과정 중 JS PairProgramming과제를 진행하며 회고를 정리하는 글이다. 08 Toast TIL 1. 아직 존재하지 않는 요소를 불러와야 할 때 click event로 생기는 toast 속 요소의 X버튼을 클릭하면 toast를 삭제하고자 한다. document.querySelector('.toast-close').addEventListner('click', e => { e.target.parentNode.remove(); }); 위 방법에서는 전역에서 .toast-close 요소를 취득하려고 한다. 하지만, .toast-close는 .button-container가 click되면 생성되는 요소이므로 이 시점에서는 .toast-close가 없다. 따라서,..
2023. 5. 9. 10:50