I find a class (used for a multiple td) and I would like to add at all td with this class, another class.
The class for every td is $day-momento-$x ($day is the number of today, $x can be 1, 2 or 3, because I've 3 columns).
This is my javascript code
var ora = new Date();
oo = ora.getHours();
giorno = ora.getDate();
//console.log('oo: '+ oo + ', giorno: ' + giorno);
if (oo >= 4 && oo < 12) {
$('.'+giorno+'-giornata-1').addClass('online');
} else if (oo >= 12 && oo < 20) {
$('.'+giorno+'-giornata-2').addClass('online');
} else if (oo >= 20 && oo < 4) {
$('.'+giorno+'-giornata-3').addClass('online');
}
php/html code
at top I've connection with DB, and $i
from of ajax code
$i = $_POST['contatore_giorni'];
$numeroGiorno = date("j", strtotime("+".$i." days"));
$contatore = 0;
for ($m_p_s = 1; $m_p_s < 4; $m_p_s++) {
$stampa_punti .= '<td class="'.$numeroGiorno.'-giornata-'.$m_p_s.'">';
[.....]
The last if says: if number is bigger than 20, but smaller than 4 (this will never happen...)