SO - 16535849

by Arun P Johny

HTML

<table>
    <thead>
        <tr><th class='fc-id1 ui-widget-header'>09:00</th></tr>
        <tr><th class='fc-id2 ui-widget-header'>09:30</th></tr>
        <tr><th class='fc-id3 ui-widget-header'>11:18</th></tr>
    </thead>
    <tbody>
        <tr id='res1'><td class='fc-id4 ui-widget-content fc-resource1'><div class='day-content'></div></td></tr>
        <tr id='res2'><td class='fc-id5 ui-widget-content fc-resource2'><div class='day-content'></div></td></tr>
        <tr id='res3'><td class='fc-id6 ui-widget-content fc-resource3'><div class='day-content'></div></td></tr>
    </tbody>
</table>

CSS

th.now {
    color: green
}

JavaScript

$('th').each(function () {
    var $this = $(this);
    var d = new Date();
    var text = $this.text();
    var parts = text.match(/(\d+):(\d+)/);
    if (parseInt(parts[1], 10) == d.getHours() && parseInt(parts[2], 10) == d.getMinutes()) {
        $this.addClass('now');
    }
});