-
Day 12 FAQ CollapseUDEMY/50 Projects In 50 Days - HTML, CSS & JS 2023. 11. 27. 18:50728x90반응형SMALL
동영상을 재생하기 전에 답을 먼저 생각해보세요.
5개 중에 하나라도 웃겼으면 광고 눌러주십쇼! 1원 벌게!!!
HTML
CSS
JS
const toggles = document.querySelectorAll(".faq-toggle");
toggles.forEach((toggle) => {toggle.addEventListener("click", () => {toggle.parentNode.classList.toggle("active");});});display: none to block;
parentNode
The read-only parentNode property of the Node interface returns the parent of the specified node in the DOM tree.
Document and DocumentFragment nodes can never have a parent, so parentNode will always return null. It also returns null if the node has just been created and is not yet attached to the tree.
if (node.parentNode) { // remove a node from the tree, unless // it's not in the tree already node.parentNode.removeChild(node); }
728x90반응형LIST'UDEMY > 50 Projects In 50 Days - HTML, CSS & JS' 카테고리의 다른 글
Day14. AnimatedNavigation (0) 2024.01.02 Day13. RandomChoicePicker (0) 2024.01.02 Day 11 Event KeyCodes (1) 2023.11.27 DAY10 Dad Jokes (0) 2023.11.27 Day9 Sound Boards (0) 2023.11.27