its working for each row. how use it for only one at once from any row? add class only to clicked column in any row and all other td in all tr class should be empty. pls help
$('td').click(function(){
$(this).siblings('td').removeClass('active');
$(this).addClass('active');
});
You need to remove active
class from all td
element's. As of now you are removing the class only from sibling td
elements.
$('td').click(function(){
$('td.active').removeClass('active'); //Remove active class from all td
$(this).addClass('active');
});