순댓국 2023. 11. 27. 18:50
728x90
반응형
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