Saving the number of times a user clicks a button

409 views Asked by At

I have a question similar to: Counting the number of clicks by pressing a button

The code works, however I cannot get the number of times clicked to save in the LabJS file. Can anyone please help?

var clicks = 0;
trigger = function() {
  clicks += 1;
  document.getElementById("display").innerHTML = clicks;
}
<main>
  <button class="trigger" id="trigger" onclick="trigger()">READ IT!</button>
  <div id="display">0</div>
  </div>
</main>

0

There are 0 answers