0

So, my countdown script is for some reason not compatible with my code. Im trying to make it countdown to a specific time each day, but my web store is limited to only use jquery 1.x with all my other plugins so no other jquery version can be used. https://jsfiddle.net/nskhbL12/

<script>
    window.onload = date;

    function ShowTime() {
       var now = new Date();
       var hrs = 20-now.getHours();
       var mins = 60-now.getMinutes();
       var secs = 60-now.getSeconds();
       timeLeft = "" +hrs+' t : '+mins+' m : '+secs+' s';
       $("#countdown").html(timeLeft);
    }

    var countdown;
    function StopTime() {
        clearInterval(countdown);
    }

    setInterval(ShowTime ,1000);
</script>
<span id="date">Order before <span id="countdown"></span> and receive your package tomorrow!</span>

1 Answers1

0

Try with

jQuery(function($) {
    setInterval(ShowTime ,1000);
});

Or use something like

$ = jQuery;

Theraloss
  • 700
  • 2
  • 7
  • 30