I have a following code in my html file and i want to access the grand parent of an element like the table which is the grand parent of td in the following code. For this I used the following jquery syntax but it displays "undefined". can any one guide me where the problem is ?
<script type="text/javascript">
$(document).ready(function () {
alert($('td[id="4"]').parents().eq(1).attr("id"));
});
</script>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div class="ui-layout-center" id="center" runat="server">
<table id="Table1" >
<tr id="tr1">
<td id="3" class="cell" >
first cell
</td>
<td id="4" class="cell">
second cell
</td>
</tr>
</table>
<br />
<br />
</div>
</form>
</body>
</html>