JSFiddle - React, Tailwind, and code Playground

by Ilia Lesnykh

HTML

<div>24.05.2014</div>
<div>25.05.2014</div>
<div>26.05.2014</div>
<div>27.05.2014</div>
<div>28.05.2014</div>
<div>29.05.2014</div>
<div>30.05.2014</div>

CSS

div {
    border: 1px solid #ccc;
    width: 150px;
    height: 150px;
    line-height: 150px;
    text-align: center;
    margin: 10px;
    float: left;
}

JavaScript

function fillBeforeToday() {
    var date = new Date();
    var month = date.getMonth() + 1;
    if (month <= 9) {
        month = '0' + month;
    }
    var today_date = date.getDate() + '.' + month + '.' + date.getFullYear();

    var $row = $('div:contains(' + today_date + ')');
    var index = $row.index();
    $('div').slice(0, index + 1).css('background-color', 'red');
}

fillBeforeToday();