29
Views
8
Comments
[Countdown] " $(...).countdown is not a function" issue in countdown
countdown
Web icon
Forge asset by Diogo Pereira
Application Type
Traditional Web

i got this error from countdown block

" $(...).countdown is not a function"

how to solve this

2021-01-04 08-13-48
Toto
 
MVP

Hi @vishnu shankar ,

That kind error message usually not including the JQuery javascripts.

But I have check the plugin, JQuery is in the plugin in the countdown block.

Can you share your oml ?

2023-11-22 10-51-50
Jozy Sohail

Hi Vishnu,

When are you getting this error? Can you please elaborate?

Regards.

Jozy

UserImage.jpg
vishnu shankar

I am not getting this error at very first time, Initially its working fine, but after some attempts it was throwing that error.


I enclosed the count down block in If widget, initially Boolean variable having false value, when i show timer i change Boolean value to true and refresh that if widget, and changing that value to false when i close.

2023-11-22 10-51-50
Jozy Sohail

I tried your scenario but i didn't get any error.

may be your jquery is not loaded properly.

UserImage.jpg
vishnu shankar

Will including a jQuery script within the expression before that block resolve the issue? 

<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script> 

2023-11-22 10-51-50
Jozy Sohail

you can give it a try, sorry but i am not sure about this.

2021-01-04 08-13-48
Toto
 
MVP

Hi visnu,


Have you tried Jozy suggestion ? 

For the root cause, my guess this is because the JQuery is inside the plugin (countdown block) and this is not rendered because inside if widget and the status still false. When you change the status, the javascript haven't run yet, but the function is already called.

Another suggestion from me, you move the JQuery of the countdown to another block, and load that block outside if widget.

UserImage.jpg
vishnu shankar

Yes @Toto i tried that method, but that not worked,

and i created  countdown jquery block and placed that outside the if widget

copied from

https://github.com/hilios/jQuery.countdown/blob/master/dist/jquery.countdown.js

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.