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

197
Views
How can I get this timer script to function within a html/js element in ClickFunnels?

I've been trying to figure out how to get this to work in a single HTML/JS element in ClickFunnels.

I need to use a div tag instead of body tag but unfortunately I cannot use onLoad with divs as I've recently discovered.

I would highly appreciate any help on this as I've already spent a few hours trying to figure this out.

Here is the HTML

<body onLoad="startCount();">
     
    <span class="timerz">Spots remaining: <span id="counterz">19</span></span>
     
</body>

Here is the JS

<script>
var timer;

function startCount() {
  timer = setInterval(count, 500); // 200 = 200ms delay between counter changes. Lower num = faster, Bigger = slower.
}

function count() {
  var rand_no = Math.ceil(3 * Math.random()); // 9 = random decrement amount. Counter will decrease anywhere from 1 - 9.
  var el = document.getElementById("counterz");
  var currentNumber = parseFloat(el.innerHTML);
  var newNumber = currentNumber - rand_no;
  if (newNumber > 0) {
    el.innerHTML = newNumber;
  } else {
    el.innerHTML = "1"; // This message is displayed when the counter reaches zero.
  }
}
</script>
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!