I'm trying to capture the id
attribute on the parent here, and It returns as undefined
<table>
<tr id="1343">
<td><span class="hi">Hi</span></td>
</tr>
</table>
Javascript:
var $id = $(".hi").parent("tr").attr("id");
alert($id);
I thought I was using it right, but I guess not, anyone know why it won't give me the value I'm trying to get?
Here's a fiddle: http://jsfiddle.net/AsDY6/