You can select all of these elements with XPath:
var headings = document.evaluate( "//tr[td[2][contains(text(),'File')]]", document, null, XPathResult.ANY_TYPE, null ); while(a = headings.iterateNext()) { console.log(a); }
jsfiddle link
Not with css: can't back off.
Edit:
See Dan's post (below) for an explanation of the parts. The difference between the two is that I start with the tr
element and give it the condition that it must contain td
with "File"
, while Dan's solution starts with td
, it indicates that it should contain "File"
, then raise the level to tr
.
It also includes a link to the excellent XPath test page .
source share