I have a table .Table id is resultTable. Some of the rows in the table have a clas开发者_如何学运维s.
How can i remove those classes from that table.
I am using the code given below to add the class
$('#resultTable tr').click(function (event) {
$(this).addClass("test");
});
TO remove the class test from the entire table , i tried the code given below
$('#resultTable').removeClass("test");
But its not working.Any ideas?
You forgot a tr
$('#resultTable tr').removeClass("test");
To remove all classes from all table rows of the resultTable
:
$('#resultTable tr').removeAttr('class');
To remove just the class
of 'test':
$('#resultTable tr.test').removeClass('test');
$('#resultTable').find('.test').each(function(){
$(this).removeClass("test");
});
精彩评论