0
I am using a countdown (countdown) on my page. After some searches I found the Countdownjs. I was following this tutorial until I realized that even without changing anything in the code of the script I downloaded from Official website it displays an error in the console:
There really is a wrong character in the code or is some configuration that needs to be done in the environment?
HTML:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Countdown</title>
</head>
<body>
Countdown until 2050
<h1 id="countdown-holder"></h1>
<script src="countdown.js"></script>
<script>
var clock = document.getElementById("countdown-holder")
, targetDate = new Date(2050, 00, 01); // Jan 1, 2050;
clock.innerHTML = countdown(targetDate).toString();
setInterval(function(){
clock.innerHTML = countdown(targetDate).toString();
}, 1000);
</script>
</body>
</html>
SCRIPT: https://bitbucket.org/mckamey/countdown.js/raw/tip/countdown.js
in
<script src="js/countdown.js"></script>
you must not have correctly added the value insrc="js/countdown.js"
, check the actual script path and replacejs/countdown.js
by it, this error happens because Countdown does not exist yet and you are trying to use it in your code.– Jonatan Ribeiro dos Santos
The path is correct, it’s already been changed! Following your theory, maybe I’m writing in the wrong place, seeing that I use Yeoman and he has some quirks about it. I’ll take a look.
– Phellipe Lins
that she may be in a different scope
– Jonatan Ribeiro dos Santos
No, the error continues! This time I’m sure there’s nothing wrong with the directories and scopes. I remember that this error already occurred when I tried to use this object before the semicolon. I do not understand well! :/
– Phellipe Lins
would be able to post the code to analyze?
– Jonatan Ribeiro dos Santos
Are you sure the @Silvioandorinha answer solved your problem? Because in practice it doesn’t change your code.
– bfavaretto