0

I would like to select with jQuery all td elements of a table given in myT variable. I do not want to select tds from inner tables. I need a cross-browser solution and it should work with thead, tbody and without them.

So I would like a sum of:

myT.find(">tbody>tr>td"); myT.find(">thead>tr>td"); myT.find(">tr>td"); // is this necessary? // is there something missing? 

4 Answers 4

3

How about:

myT.find("td").not("td td"); 
Sign up to request clarification or add additional context in comments.

1 Comment

Nice. I accepted Kae's solution though, because I think it might be faster.
2

this might do it:

myT.find('>*>tr>td, >tr>td'); 

Comments

0
myT.children('tr td'); 

or

myT.children('tr td').not('td table'); 

Children()

Comments

0
var tblMaint = $("#tbl1") var tblInner = $("#tblInner").find("td"); alert(tblMaint.find("td").not(tblInner).length); 

JsFiddle Here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.