Advertisement
Onesible

Untitled

Mar 27th, 2025
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve() {
  2.     document.querySelectorAll('button').forEach(b => b.addEventListener('click', showInfo));
  3.  
  4.     function showInfo(e) {
  5.         let hidden = e.target.parentElement.getElementsByClassName('hidden-fields active')[0];
  6.         let unlockButton = e.target.parentElement.querySelectorAll('input[type="radio"]')[1];
  7.  
  8.         if (e.target.textContent === 'Show more') {
  9.             if (unlockButton.checked) {
  10.                 hidden.style.display = 'block';
  11.                 e.target.textContent = 'Show less'
  12.             }
  13.         } else {
  14.             if (unlockButton.checked) {
  15.                 hidden.style.display = 'none';
  16.                 e.target.textContent = 'Show more'
  17.             }
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement