So what I’m trying to do is get the last row of an HTML table. If this row then has a certain class I will ignore this row and select the previous one. This would then be cycled through from the end of the table until a row was found without this certain class.
I figured it’s probably involving a for loop, a check for the row class and then JQuery’s row.prev method, but still not quite sure how to approach this.
Thanks in advance!
Assuming you’ve got the following HTML:
You can do this:
:not(.certainclass)will eliminate<tr>without class ‘certainclass’:lastwill get you the last oneI invite you to check the Selectors documentation page of jquery to learn more about them.