it is a sample code for two group. the first group Reach 54 point win. how ever I would like to add further conduction if any one of the team Reach 26-0 he will win. i try to add "if" and "else", but i did mange to sort the Issue.
for Example I want to make if the Counter of firstFunct=26 and Counter of secondFunct=0 Group 1 Win
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
const firstFunct = (() => {
let counter = 0;
return () => {
counter += +document.getElementById("mySelect").value;
document.getElementById("mySelect").value = null;
document.getElementById("Group 1 score").innerHTML = counter;
if ((counter) >= 54) {
document.body.innerHTML = "<p class='Group'>Group 1 Win</p><p onClick='location.reload()' class='Again'>Again</p>";
}
};
})();
const secondFunct = (() => {
let counter = 0;
return () => {
counter += +document.getElementById("mySelect2").value;
document.getElementById("mySelect2").value = null;
document.getElementById("Group 2 score").innerHTML = counter;
if ((counter) >= 54) {
document.body.innerHTML = "<p class='Group'>Group 2 Win</p><p onClick='location.reload()' class='Again'>Again</p>";
}
};
})();
</script>
<body>
<div class="line"></div>
<div class="row">
<div class="column">
<h2>Group 1</h2>
<form>
<select id="mySelect" onchange="firstFunct()">
<option value="" disabled selected style="display:none;">+</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>12</option>
<option>14</option>
<option>16</option>
<option value="54">Win</option>
</select>
<p id="Group 1 score" style="font-size: 75px;">0</p>
</div>
<div class="column">
<h2>Group 2</h2>
<form>
<select id="mySelect2" onchange="secondFunct()">
<option value="" disabled selected style="display:none;">+</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>12</option>
<option>14</option>
<option>16</option>
<option value="54">Win</option>
</select>
<p id="Group 2 score" style="font-size: 75px;">0</p>
</div>
</div>
</body>