Sachin Kainth
Sachin Kainth

Reputation: 46780

$().countdown is not a function

I have got this line in my code

$('#timeLeftDiv').countdown({ until: expires, timezone: 0, serverSync: serverTime, onTick: serverTime, tickInterval: 60 });

and it is giving me this error

TypeError: $("#timeLeftDiv").countdown is not a function

The contents of the timeLeftDiv are refreshed Ajaxily. Does this have anything to do with it?

I have included this line in my code

<script src="/<path>/jquery.countdown.min.js">

What am I missing?

Upvotes: 2

Views: 14478

Answers (4)

jimmy webexpert
jimmy webexpert

Reputation: 1

I fixed my Problem just by removing that

$(document).ready(function() { });

because I was having two versions of jQuery loading and also this was in other function. The issue I got was from the countdown. It was solved by removing it and leaving only a function. Try doing it this way: it worked for me.

Upvotes: 0

masil
masil

Reputation: 53

make sure you include countdown.js after plugin.js

<script type="text/javascript" src="js/jquery.plugin.js"></script>    
<script type="text/javascript" src="js/jquery.countdown.js"></script>

Upvotes: 0

efrendiaz
efrendiaz

Reputation: 39

Hello I had the same problem, and I fixed it by using.

jQuery('#timeLeftDiv').countdown({ until: expires, timezone: 0, serverSync: serverTime, onTick: serverTime, tickInterval: 60 });

As you can see I replaced $ for jQuery, this is because I'm also using prototype on my project, and I think there is some sort of conflict with this plugin.

I hope it helps.

Upvotes: 2

gherkins
gherkins

Reputation: 14985

might be the missing </script> tag.

assuming you have included jQuery before, try:

<script type="text/javascript" src="/<path>/jquery.countdown.min.js"></script>

Upvotes: 4

Related Questions