Having trouble setting up JavaScript to automatically bold the next clock time. Any tips on rewriting the JavaScript? For instance, if it is currently 6:49, I want the next clock time of 7:32 to be automatically bolded. And when the time reaches 7:32, I want 8:01 to be automatically bolded next. So, essentially, always bolding the upcoming time once the current time has passed.
jQuery(document).ready(function($) {
var hour = new Date().getHours();
$('table td:nth-child(1)').each(function(index, td) {
if ($(td).text().indexOf(hour) == 00) {
$(td).addClass('highlight-time');
} else {
$(td).removeClass('highlight-time');
}
});
});
.highlight-time {
font-weight: bold;
}
<table>
<tbody>
<tr>
<td style="padding-left: 0px;width: 75px;">6:49</td>
<td style="padding-left: 0px; padding-right: 0px;">BLERI-COM</td>
</tr>
<tr>
<td style="padding-left: 0px;width: 75px;">7:32</td>
<td style="padding-left: 0px; padding-right: 0px;">ENDRITI</td>
</tr>
<tr>
<td style="padding-left: 0px;width: 75px;">8:01</td>
<td style="padding-left: 0px; padding-right: 0px;">BEKA-KAQANIK</td>
</tr>
<tr>
<td style="padding-left: 0px;width: 75px;">8:21</td>
<td style="padding-left: 0px; padding-right: 0px;">MEDINA</td>
</tr>
<tr>
<td style="padding-left: 0px;width: 75px;">8:59</td>
<td style="padding-left: 0px; padding-right: 0px;">METI-COMERC</td>
</tr>
<tr>
<table>
<tbody>