Highlighting Todays Work Day of the Week in an HTML Table using only CSS/Javascript/Jquery

I would like my computer to automatically highlight todays day of the week in a table row.

The table has all the weekdays in a separate row, and has a fixed number of seven rows, starting with the least pleasant day of all days, Monday or Maandag in Dutch.

Lets say its Tuesday today or Dinsdag in Dutch, then the second row should be highlighted like so:

enter image description here

However, the problem is that instead of todays day, the next day is highlighted.
Probably I’ve overlooked something small.
The solution can be onlly in HTML/CSS/JS/JQuery and not in PHP.
I have made a demo of my half-working half-defective exemaple:




function workday() {
  var d = new Date().getDay();



        <tr id="day-0">
        <tr id="day-1">
        <tr id="day-2">
        <tr id="day-3">
        <tr id="day-4">
        <tr id="day-5">
        <tr id="day-6">

>Solution :

Happens because Monday is the first day of the week not 0th.

Start numbering ids from 1 not 0

Leave a Reply