JSFiddle - React, Tailwind, and code Playground
HTML
<div id="scoDom" class="score sc1">0</div>
<div id="scoExt" class="score sc2">
<label id="displayExt">0</label>
<div id="plusExt" class="addscoreExt">
<img id="inc" src="images/challenge_score_addgoals.png">
</div>
<div id="plusExt" class="removescoreExt">
<img id="dec" src="images/change_score_removegoals.png">
</div>
</div>
CSS
#scoDom
{
position: absolute;
width: 100px;
background-color: aliceblue;
}
#scoExt
{
position: absolute;
width: 100px;
background-color: aliceblue;
}
.score.sc1 {
border-radius: 5px 0 0 5px;
top: 125px;
}
.addscoreExt {
top: -60px;
right: -27px;
position: absolute;
}
.removescoreExt {
top: 10px;
right: -27px;
position: absolute;
}
.score.sc2 {
border-radius: 0 5px 5px 0;
top: 125px;
left: 110px;
}
.score {
font-size: 6em;
line-height: 1em;
width: 105px;
height: 97px;
letter-spacing: -1px;
color: cadetblue; /* changer si = 0 (blanc) pour betonscore ou rouge si perdu (résultat connu) */
background: #fff;
text-align: center;
border: 0 none;
font-family: fantasy;
margin: 0;
padding: 0;
vertical-align: baseline;
}
JavaScript
var i = 0;
function incNumber() {
if (i < 10) {
i++;
}
else if (i == 10) {
i = 0;
}
document.getElementById("displayExt").innerHTML = i;
}
function decNumber() {
if (i > 0) {
--i;
} else if (i == 0) {
i = 10;
}
document.getElementById("displayExt").innerHTML = i;
}
document.getElementById('inc').addEventListener('click', incNumber);
document.getElementById('dec').addEventListener('click', decNumber);