Reputation: 187
The Final Countdown is not appearing on my page when i open it in Google Chrome. I'm not quite sure why the countdown does not function. Can someone please help me out here? Thanks a lot!
<!DOCTYPE html>
<html>
<head>
<title>The Final Countdown</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery.countdown.min.js"></script>
<script type="text/javascript">
$('#getting-started').countdown('2016/01/01', function(event) {
$(this).html(event.strftime('%w weeks %d days %H:%M:%S'));
});
</script>
</head>
<body>
<div id="getting-started"></div>
</body>
</html>
Upvotes: 2
Views: 641
Reputation: 337570
You need to execute your code once the DOM is ready. You can do this by putting it in a DOMReady handler:
$(function() {
$('#getting-started').countdown('2016/01/01', function(event) {
$(this).html(event.strftime('%w weeks %d days %H:%M:%S'));
});
});
At the moment you're calling the countdown()
method on the #getting-started
element before it exists in the DOM.
Upvotes: 1