I am wondering if jQuery can do something like this or is there another way to do this?
$(".row_c:last|.row_d:last").css("color","red");
I have alternating rows that I want to find the last row which is either row_c or row_d however the catch is that row_c or row_d is inserted in between another set of alternating rows row_a and row_b so to illustrate:
OR
can we use the | or operator in jQuery? Or is there something similar?
Two selectors: visible and: hidden are also available in JQuery.
Starting from jQuery 1.9, virtually all selectors in the level 3 standard are supported by Sizzle (its underlying selector library), with the following exceptions: jQuery cannot select any pseudo-elements as they are CSS-based abstractions of the document tree that can't be expressed through the DOM.
Yes, I believe it does, but in a CSS manner (jsfiddle as a proof):
$(".row_c:last, .row_d:last").css("color","red");
EDIT:
If you wanted to match only last element having class row_c
or row_d
, you may wish to use something like that (jsfiddle as a proof):
$(".row_c, .row_d").last().css("color","red");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With