From this:
var $saved = $('#parent').find('a');
How can I now subselect those elements in $saved
which have class myClass
?
I don't want descendents (so find
or children
are no good), I want the subset of $saved.
var $refined = $saved.[something something];
Essentially, I want $refined
to be equal to $('#parent').find('a.myClass');
but to start from $saved
.
Thanks.
You can use filter method:
var $refined = $saved.filter(".myClass");
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