I want to find a <td role="foo" class="one two three four">
within a <div id="myid">
These two selectors work:
$('#myid td[role=foo]')
$('#myid .two')
But this one doesn't, why?
$('#myid .two td[role=foo]')
Because a space in a selector string is a descendant-selector.
You would need to do:
$('#myid td.two[role=foo]')
The way you had it, you were searching for <td role="foo">
elements that are a descendant of .two
.
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