mekasu0124

Untitled

Feb 18th, 2024
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var coll = document.getElementsByClassName("collapsible");
  2.  
  3. for (let i = 0; i < coll.length; i++) {
  4.   coll[i].addEventListener("click", function() {
  5.     this.classList.toggle("active");
  6.    
  7.     var content = this.NextElementSibling;
  8.     var content_style = content.style.display
  9.  
  10.     if (content_style === "block") {
  11.       content_style = "none";
  12.     } else {
  13.       content_style = "block";
  14.     }
  15.   });
  16. }
Advertisement
Add Comment
Please, Sign In to add comment