I’m trying to add a class to a table.
<table> > <tbody> > <tr> > <td> > <table> > <tbody> > <tr> > <td> > <span class="subcategory">
So basically I’d like to add a class to the initial table based on the span.subcategory.
I have this:
$('span.subcategory').parent().closest("table").addClass('myClass');
But it only goes to the second table.
1 Answer