I am trying to get the class name of each td and then adding another class to each td. For example: The current class is class = "X-marker" and I want to add another class bgreen and it should be class = "X-marker bgreen".
I used each method to get the class name of each td and then used attr with each to set but it doesn't work. I don't get any error but it isn't working as expected.
The object is called winInfo and the array variable is: winInfo.play = winArray[i];
var winInfo = checkWin();
if (winInfo.win) {
currentClass = $(winInfo.play).each(function () {
$(this).attr('class');
});
$(winInfo.play).each(function () {
$(this).attr('class', currentClass + ' bgreen');
});
}