I need to remove a class from any place withing a table if another class is not found inside a span that is residing inside that table.
Basically I need to do the opposite of hasClass but I’m not sure what I’m doing wrong. Here’s my code:
if ($("#nyTable").find("span").not("ui-icon-triangle-1-s")) {
$("#nyTable").find("td").removeClass("redText");
}
<table>
<tr>
<td>as</td>
<td>asd</td>
<td>werwe</td>
</tr>
<tr>
<td><span class="ui-icon-triangle-1-s">asd</span></td>
<td><span class="ui-icon-triangle-1-s">asd</span></td>
<td><span class="ui-icon-triangle-1-s">asd</span></td>
</tr>
</table>
UPDATE: I need to make sure that this class .ui-icon-triangle-1-s does not exist anywhere in the table.
1 Answer