Difference between revisions of "MediaWiki:Common.js"
Jump to navigation
Jump to search
Line 2: | Line 2: | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
− | var wagonSelection | + | var wagonSelection; |
$('#wagon-configurator-list li').click(function(){ | $('#wagon-configurator-list li').click(function(){ | ||
Line 10: | Line 10: | ||
alert("You selected " + wagonSelection); | alert("You selected " + wagonSelection); | ||
console.log(wagonSelection); | console.log(wagonSelection); | ||
− | |||
}); | }); | ||
$('#wagon-configurator li.wagon-slot').click(function(){ | $('#wagon-configurator li.wagon-slot').click(function(){ | ||
+ | wagonSelection = $('#wagon-configurator-list li.selected').classList[0]; | ||
alert("You selected " + wagonSelection); | alert("You selected " + wagonSelection); | ||
}); | }); | ||
}); | }); |
Revision as of 19:14, 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]; alert("You selected " + wagonSelection); console.log(wagonSelection); }); $('#wagon-configurator li.wagon-slot').click(function(){ wagonSelection = $('#wagon-configurator-list li.selected').classList[0]; alert("You selected " + wagonSelection); }); });