JSFiddle - React, Tailwind, and code Playground
by apaichon
HTML
Liverpool
<input id="liverpool" type="text" />
Mancity
<input id="mancity" />
<span id="Result">
</span>
<button onclick="playResult()">
Finish
</button>
JavaScript
function playResult() {
let liverpoolScore = parseInt(document.getElementById('liverpool').value);
let mancityScore = parseInt(document.getElementById('mancity').value)
let result = document.getElementById('Result');
var liv = 0;
if (liverpoolScore > mancityScore)
{
let liv = 1;
result.innerHTML =
"<h1>Liverpool is Winner</h1>";
//"Liverpool is Winner!" ;
} else if (liverpoolScore < mancityScore) {
result.innerHTML = "Macity is Winner!";
} else {
result.innerHTML = "Draw";
}
result.innerHTML = liv;
}