Fix: Default player count and initialize player type rows
This commit is contained in:
@@ -72,6 +72,12 @@ class GameUI {
|
||||
const playerCountSelect = document.getElementById('player-count');
|
||||
const playerTypeRows = document.querySelectorAll('.player-type-row');
|
||||
|
||||
// Initialize player type rows visibility based on default selection
|
||||
const initialCount = parseInt(playerCountSelect.value);
|
||||
playerTypeRows.forEach((row, index) => {
|
||||
row.style.display = index < initialCount ? 'flex' : 'none';
|
||||
});
|
||||
|
||||
playerCountSelect.addEventListener('change', (e) => {
|
||||
const count = parseInt(e.target.value);
|
||||
playerTypeRows.forEach((row, index) => {
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
<div class="setup-group">
|
||||
<label for="player-count">Total Players:</label>
|
||||
<select id="player-count">
|
||||
<option value="2">2 Players</option>
|
||||
<option value="3" selected>3 Players</option>
|
||||
<option value="2" selected>2 Players</option>
|
||||
<option value="3">3 Players</option>
|
||||
<option value="4">4 Players</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user