Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function lockedProfile() {
- const btns = [...document.getElementsByTagName('button')];
- btns.forEach(btn => btn.addEventListener('click', showHide));
- function showHide(event) {
- const button = event.target;
- const profile = button.parentNode;
- const moreInformation = profile.getElementsByTagName('div')[0];
- const lockStatus = profile.querySelector('input[type="radio"]:checked').value;
- if (lockStatus === 'unlock') {
- if (button.textContent === 'Show more') {
- moreInformation.style.display = 'inline-block';
- button.textContent = 'Hide it';
- } else if (button.textContent === 'Hide it') {
- moreInformation.style.display = 'none';
- button.textContent = 'Show more';
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement