No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
(function () { | (function () { | ||
// If Participants team list with a toggle button is added, then make that button clickable | |||
var myElement = document.getElementById('team-toggle'); | |||
if ( myElement ) { | |||
myElement.addEventListener('click', function(e){ | |||
if ( e.target.innerHTML === 'Show Players' ) e.target.innerHTML = 'Hide Players'; | |||
else e.target.innerHTML = 'Show Players'; | |||
document.querySelectorAll('.team-list .players').forEach(function(el){ | |||
el.classList.toggle('show'); | |||
}); | |||
}); | |||
} | |||
}()); | }()); |
Revision as of 20:43, 11 September 2022
/* Any JavaScript here will be loaded for all users on every page load. */
(function () {
// If Participants team list with a toggle button is added, then make that button clickable
var myElement = document.getElementById('team-toggle');
if ( myElement ) {
myElement.addEventListener('click', function(e){
if ( e.target.innerHTML === 'Show Players' ) e.target.innerHTML = 'Hide Players';
else e.target.innerHTML = 'Show Players';
document.querySelectorAll('.team-list .players').forEach(function(el){
el.classList.toggle('show');
});
});
}
}());