MediaWiki:Common.js: Difference between revisions

MediaWiki interface page
No edit summary
No edit summary
Line 3: Line 3:
   var myElement = document.getElementById('team-toggle');
   var myElement = document.getElementById('team-toggle');
   if ( myElement ) {
   if ( myElement ) {
   myElement.addEventListener('click', function(){
   myElement.addEventListener('click', function(e){
   console.log('clickediclick');
   console.log(e);
  document.querySelectorAll('.team-list .players').forEach(function(el){
  document.querySelectorAll('.team-list .players').forEach(function(el){
  console.log(el);
  el.classList.toggle('show');
  el.classList.toggle('show');
  });
  });

Revision as of 20:41, 11 September 2022

/* Any JavaScript here will be loaded for all users on every page load. */
(function () {
  var myElement = document.getElementById('team-toggle');
  if ( myElement ) {
  	 myElement.addEventListener('click', function(e){
  	 	console.log(e);
	  	document.querySelectorAll('.team-list .players').forEach(function(el){
	  		el.classList.toggle('show');
	  	});
	  });
  }
}());