Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda