Burt
Burt

Reputation: 7758

Get Parent Tables Parent Table jQuery

I am working with Sharepiont and the code it spits out is messy at best.

I have the id of a div inside a table which is inside another table and I need to get at the parent tables parent table.

Here is the JsFiddle I am working with:

http://jsfiddle.net/BpnNJ/2/

Can anyone help please?

Upvotes: 1

Views: 1629

Answers (2)

MirzaShakir
MirzaShakir

Reputation: 399

I have changed your code & found something interesting about your question. As your question you need to have parents parent table, so I've here is the method for that

$("div").closest("table").closest("table").attr('class');

Here is an full working example JS FIDDLE

Upvotes: 0

Manuel van Rijn
Manuel van Rijn

Reputation: 10305

$("div").parents("table").parents("table")

Upvotes: 4

Related Questions