Advertisement
mmishanchyk

Accordion

Sep 25th, 2021
1,341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function toggle() {
  2.     let button = document.querySelector(".button");
  3.     let textDIV = document.getElementById("extra");
  4.  
  5.     button.textContent = button.textContent == "More" ? "Less" : "More";
  6.     textDIV.style.display = textDIV.style.display == "none" ?
  7.         textDIV.style.display == "block" :
  8.             textDIV.style.display == "none";
  9.  
  10.    
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement