Advertisement
Silviya7

3.Locked Profile

Apr 9th, 2024
701
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function lockedProfile() {
  2.    
  3.     let AllElement= document.querySelectorAll('.profile');
  4.  
  5.     for (const element of AllElement) {
  6.         let currentbtn= element.querySelector('.profile button');
  7.      
  8.         currentbtn.addEventListener('click',()=>{
  9.             const lockedRadio= element.querySelector('input[type=radio][value=lock]')        
  10.            const hiddeninfo= currentbtn.previousElementSibling;
  11.            if(!lockedRadio.checked){
  12.             if(currentbtn.textContent =='Hide it'){
  13.                 hiddeninfo.style.display='none';
  14.             }
  15.             else{
  16.  
  17.             hiddeninfo.style.display='block';
  18.             currentbtn.textContent='Hide it';
  19.             }
  20.            }
  21.            
  22.         })
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement