I have the code below
Javascript and HTML
function uppass () {
var element = document.getElementById("newclient");
var value = element.innerHTML;
++value;
console.log(value);
document.getElementById("newclient").innerHTML = value;
}
<!DOCTYPE HTML>
<html>
<head>
<title>
clicked button in JavaScript
</title>
</head>
<body style = "text-align:center;">
<header>
<h1> Clicker customer queue identify button</h1>
</header>
<center>
<button id="c" class="button" onclick="uppass()" style=" font-size: 16px; margin: 0 10px;"> Common </button>
<button id="f" type="button" onclick="uppass()" style=" font-size: 16px; margin: 0 10px;"> Fast </button>
<button id="p" type="button" onclick="uppass()" style=" font-size: 16px; margin: 0 10px;"> Priority </button>
</center>
<h5>Sua senha é:</h5><h2 id="newclient" style="font-size: 12px; display: inline-block; padding-left: 20px;">0</h5>
</body>
</html>
I am implementing buttons for a queue of customers, each button that is clicked will increase a number. Until then I managed to solve. I want to identify each button that is clicked.
For example. When clicking on common, the letter c appears in front of the number, when clicking on fast the letter f and priority the letter p. but the numbers are still in sequence.
For example. clicking buttons randomly
c - 1
f - 2
c - 3
p - 4
f - 5
f - 6
c-7
and so on.
I managed to make the buttons and count, but I can't identify each one. Can someone help? Thanks.
Code on https://jsfiddle.net/t8y31fo5/