Advertisement
SimeonTs

3th - Accordion

Jun 6th, 2020
635
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function toggle() {
  2.     let button = document.querySelector('.button');  // Get the Button
  3.     let extra = document.querySelector('#extra');  // Get the Extra section
  4.    
  5.     // Now lets swap them out ;D
  6.     if (button.textContent === 'More') {
  7.         button.textContent = 'Less';
  8.         extra.style.display = 'block';  // Show
  9.     } else {
  10.         button.textContent = 'More';
  11.         extra.style.display = 'none';  // Hide
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement