Javascript Simple Countdown Timer – YsCountDown.js

Category: Date & Time | August 9, 2018
Javascript simple countdown timer
Author: yusufsefasezer
Official Page: Go to Website
Last Update:November 22, 2019

The “YsCountDown.js” is a pure Javascript simple countdown timer that shows days, hours, minutes and seconds. It is a tiny plugin that allows to quickly implement any kind of website.

It is a simple and easy-to-use countdown plugin. All you have to include one Js file.

This Javascript countdown timer is a simple and easy to use countdown timer plugin which is superbly easy to customize. You can customize the timmer by add or be removing the few lines of code.

  • No need any plug-in – does not need any plugin or library.
  • Easy to use – Choose a date and start using it.
  • Extensile – Extended time support.

How to Use Javascript Simple Countdown Timer

Compiled and production-ready code can be found in the dist directory. The src directory contains a development code.

<script src="path/to/yscountdown.js"></script>

You can define a timer class and then place the unordered list inside it.

<div class="timer">
      <li><span id="days">0</span>days</li>
      <li><span id="hours">0</span>Hours</li>
      <li><span id="minutes">0</span>Minutes</li>
      <li><span id="seconds">0</span>Seconds</li>

In the footer or header of your page, initialize YsCountDown. And that’s it, you’re done. Nice work!

var daysElement = document.querySelector("#days");
var hoursElement = document.querySelector("#hours");
var minutesElement = document.querySelector("#minutes");
var secondsElement = document.querySelector("#seconds");
var containerElement = document.querySelector(".timmer");
var endDate = (new Date().getFullYear() + 1) + "/01/01";

var myCountDown = new ysCountDown(endDate, function (remaining, finished) {

  if (finished) {
	containerElement.textContent = "Expired";

  daysElement.textContent = remaining.totalDays;
  hoursElement.textContent = remaining.hours;
  minutesElement.textContent = remaining.minutes;
  secondsElement.textContent = remaining.seconds;


You May Also Like

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.