Answers for "change css property each day"

0

change css property each day

let element = document.querySelector('.change-my-colour');
let date = new Date();

switch(date.getDay()) { /* use date.getDate() instead for days of the month */
  case 0: /* Sunday */
    element.style.background = "red";
    break;
  case 1: /* Monday */
    element.style.background = "orange";
    break;
  case 2: /* Tuesday */
    element.style.background = "yellow";
    break;
  /* etc... */
  default:
    break;
}
Posted by: Guest on September-20-2021

Code answers related to "change css property each day"

Code answers related to "Javascript"

Browse Popular Code Answers by Language