Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
(Wagon Slots) |
|||
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. */ | ||
− | $('#wagon-configurator-list li').click(function(){ | + | $(document).ready(function(){ |
− | + | var wagonSelection; | |
− | + | ||
− | + | $('#wagon-configurator-list li').click(function(){ | |
− | }); | + | $(this).addClass('selected'); |
+ | $(this).siblings().removeClass('selected'); | ||
+ | var wagonSelection = this.classList[0]; | ||
+ | }); | ||
− | $('#wagon-configurator li.wagon-slot').click(function(){ | + | $('#wagon-configurator li.wagon-slot').click(function(){ |
− | + | alert("You selected " + wagonSelection); | |
+ | }); | ||
}); | }); |
Revision as of 18:38, 2 August 2021
/* Any JavaScript here will be loaded for all users on every page load. */ $(document).ready(function(){ var wagonSelection; $('#wagon-configurator-list li').click(function(){ $(this).addClass('selected'); $(this).siblings().removeClass('selected'); var wagonSelection = this.classList[0]; }); $('#wagon-configurator li.wagon-slot').click(function(){ alert("You selected " + wagonSelection); }); });