Difference between revisions of "MediaWiki:Common.js"

From Unrailed! Wiki
Jump to navigation Jump to search
Line 9: Line 9:
 
var wagonSelection = this.classList[0];
 
var wagonSelection = this.classList[0];
 
alert("You selected " + wagonSelection);
 
alert("You selected " + wagonSelection);
 +
console.log(wagonSelection);
 
return wagonSelection;
 
return wagonSelection;
 
});
 
});

Revision as of 19:08, 2 August 2021

/* Any JavaScript here will be loaded for all users on every page load. */

$(document).ready(function(){
	var wagonSelection = null;
	
	$('#wagon-configurator-list li').click(function(){
		$(this).addClass('selected');
		$(this).siblings().removeClass('selected');
		var wagonSelection = this.classList[0];
		alert("You selected " + wagonSelection);
		console.log(wagonSelection);
		return wagonSelection;
	});

	$('#wagon-configurator li.wagon-slot').click(function(){
		alert("You selected " + wagonSelection);
	});
});