Advertisement
nikolapetkov824

Accordion

Jul 6th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function toggle() {
  2.     let buttonMore = document.getElementsByClassName("button")[0];
  3.     let textContentElement = document.getElementById('extra');
  4.     //textContentElement.style.display = '';
  5.  
  6.     if (buttonMore.textContent === 'More') {
  7.         textContentElement.style.display = 'block';
  8.         buttonMore.textContent = 'Less';
  9.     }else{
  10.         textContentElement.style.display = 'none';
  11.         buttonMore.textContent = 'More';
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement