0

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>
Jamiec
  • 133,658
  • 13
  • 134
  • 193
EllaM
  • 3
  • 5
  • 2
    *"however I cannot get the number of times clicked to save in the LabJS file"* - Where/how are you trying to do that and in what way does it fail? – David Oct 05 '21 at 12:38
  • 1
    I have changed your code for a snippet, which appears to work fine. Can tyou elaborate on what the issue is? ie, what is a `LabJS file`? – Jamiec Oct 05 '21 at 13:26
  • Thanks for editing! Yeah the code works, but I mean I can't get the number of times it was clicked to save in the datasheet file thats generated in labjs. – EllaM Oct 05 '21 at 14:00
  • So I would need something like "trigger" or "read it" to get saved as "8" or however many times the person clicked the button directly in the datasheet that gets generated when you run a task on labjs. And it's not doing it right now. Do you see what I mean? – EllaM Oct 05 '21 at 14:02
  • Your question asks about saving into LabJS, but there is no use of LabJS in your provided code. Please edit your question to include the relevant LabJS code. – Eldar B. Oct 10 '21 at 09:28

0 Answers0