I have a checkbox inside a table row
<tr id="1"> <td><input type="checkbox" /></td> <td>lorem</td> <td>ipsum</td> <td>css</td> </tr>
I want to get the id when the checkbox is checked
I have tried this
var closestTr = $(':checkbox:checked').closest('tr').attr('id'); alert(closestTr);
I also tried this http://jsfiddle.net/AbfJk/3/
Why doesn't it get the id?