Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
Why does this works on firefox and not on chrome or edge?

Plain javascript Basically i create a counter with reset increment and decrement options.

The one thing that does work on firefox and nowhere else is when i want the counter to have a custom starting value so for the submit function

let txtCounter = document.getElementById("counter");
let submitValue = document.getElementById("submittedValue").value;
counter = 0;
const decrease = () => {
  counter--;
  txtCounter.textContent = `${counter}`;
};
const reset = () => {
  counter = 0;
  txtCounter.textContent = `${counter}`;
};
function increase() {
  counter++;
  txtCounter.textContent = `${counter}`;
}
function submit() {
  counter = submitValue;
  txtCounter.textContent = `${counter}`;
}

And some html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="content">
      <h1>Counter</h1>
      <h2 id="counter">0</h2>
      <div class="buttons">
        <input type="number" name="" id="submittedValue" />
        <button onclick="{submit()}">submit</button>
        <button onclick="{decrease()}">decrease</button>
        <button onclick="{reset()}">reset</button>
        <button onclick="{increase()}">Increase</button>
      </div>
    </div>
    <script src="./Counter.js"></script>
  </body>
</html>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!