I am manipulating a WordPress calendar plugin. I'm trying to add some CSS to the dates on the calendar for every day up to the current date. The plugin that I'm using, has the calendar in a table. The code for an individual day looks like this:

```
<td class="day-with-date" data-date="2017-5-10">
  <div class="day-number">10</div>
</td>

```

I'm trying to use jQuery to loop through the dates from the data attribute. 

This is my script. 

```
    $('.day-with-date .day-number').each(function(element){

    var dataNumber = "[data-date=" + $(this).text() + "]"; 
    var dataDateDay = "[data-date="+day+"]";        
    var textDay = $(this).text();

    if(textDay <= day){

        $('td.day-with-date .day-number').addClass('online-display');

    }else if(textDay > day){

        $('td.day-with-date .day-number').removeClass('online-display');

    }else{
        console.log("error douche");
    }

});

```

What it's doing, is adding the CSS because textDay is <= than day. But it's removing the class after it's applied. I'm trying to get the CSS to add for all days up to today's date, then remove the CSS for days after.

How can I loop through the calendar dates, then apply my CSS class to all days up to the current date? 

Thanks in advance!