我的代码中有这一行
$('#timeLeftDiv').countdown({ until: expires, timezone: 0, serverSync: serverTime, onTick: serverTime, tickInterval: 60 });
它给了我这个错误
TypeError: $("#timeLeftDiv").countdown is not a function
Ajaxily刷新timeLeftDiv
的内容。这与它有什么关系吗?
我已将此行包含在我的代码中
<script src="/<path>/jquery.countdown.min.js">
我错过了什么?
答案 0 :(得分:5)
可能是缺少的</script>
代码。
假设您之前已经包含了jQuery,请尝试:
<script type="text/javascript" src="/<path>/jquery.countdown.min.js"></script>
答案 1 :(得分:3)
您好我遇到了同样的问题,我使用。修复了它。
jQuery('#timeLeftDiv').countdown({ until: expires, timezone: 0, serverSync: serverTime, onTick: serverTime, tickInterval: 60 });
正如你所看到的,我为jQuery替换了$,这是因为我在我的项目中也使用了原型,我认为这个插件存在某种冲突。
我希望它有所帮助。
答案 2 :(得分:0)
确保在countdown.js
plugin.js
<script type="text/javascript" src="js/jquery.plugin.js"></script>
<script type="text/javascript" src="js/jquery.countdown.js"></script>
答案 3 :(得分:0)
我只是通过删除问题来解决了
$(document).ready(function() { });
因为我有两个版本的jQuery加载,而且这也在其他函数中。我遇到的问题来自倒计时。通过删除它并仅保留一个函数来解决该问题。尝试这样做:它对我有用。