Advertisement
viligen

lockedProfile2

Jun 23rd, 2022
907
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function lockedProfile() {
  2.     let allBtnsMore = document.querySelectorAll('div button');
  3.     Array.from(allBtnsMore).forEach((b) =>
  4.         b.addEventListener('click', moreLess)
  5.     );
  6.  
  7.     function moreLess(e) {
  8.         let parentDiv = e.target.parentNode;
  9.         let lockBtn = parentDiv.querySelector('input[value=lock]');
  10.         if (lockBtn.checked == true) {
  11.             return;
  12.         }
  13.         let hiddenDiv = parentDiv.querySelector('div');
  14.         if (e.target.textContent == 'Show more') {
  15.             hiddenDiv.style.display = 'block';
  16.             e.target.textContent = 'Hide it';
  17.         } else {
  18.             hiddenDiv.style.display = 'none';
  19.             e.target.textContent = 'Show more';
  20.         }
  21.     }
  22. }
Advertisement
RAW Paste Data Copied
Advertisement