I have a table with the 12 months of the year (jan to dec)
I then have some of the months grouped together, ie: jan to apr = group1, mar to jun = group2
So all I wanna do is change the background colour of all the items with the same group name.
$('.group1').hover(function() {
$(this).addClass('tbl_navGroupHover');
}, function() {
$(this).removeClass('tbl_navGroupHover');
});
$('.group2').hover(function() {
$(this).addClass('tbl_navGroupHover');
}, function() {
$(this).removeClass('tbl_navGroupHover');
});
UPDATE, I went with this solution - tx for ur assistance:
<script>";
for ($i = 1; $i < 13; $i++) {
echo "$('.group$i').hover(function() {
$('.group$i').addClass('tbl_navGroupHover');
}, function () {
$('.group$i').removeClass('tbl_navGroupHover');
});";
}
echo "</script>";
listfor this kind of work. please avoid tablesthisjust specify the classname to change class name for all element of same group