I am really just copypasting the exact same "code" of that fiddle: https://jsfiddle.net/7b0ky186/ to my local html-file and have nothing else around it. But while it works nice in JSFiddle I get an error when starting that function within my console saying that Uncaught ReferenceError: CountDownTimer is not defined
What do I do wrong there?
<body>
<a id="startTimer">Start Count Down</a>
<div>Registration schliesst in <span id="displayTimer"></span> minutes!</div>
<script type="text/javascript">
window.onload = function() {
var display = document.querySelector('#displayTimer'),
timer = new CountDownTimer(5),
timeObj = CountDownTimer.parse(5);
format(timeObj.minutes, timeObj.seconds);
timer.onTick(format);
document.querySelector('#startTimer').addEventListener('click', function() {
timer.start();
});
function format(minutes, seconds) {
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.textContent = minutes + ':' + seconds;
}
};
</script>