Button Click Example
Creates an input button and assigns a click event to it.
by Julian
HTML
<input type="button" id="button" value="Click Me" />
<table id="myTable1">
<tbody>
<tr>
<td id="1">
cell 1
</td>
<td id="2">
Get the id of this cell
</td>
<td id="3">
cell 2
</td>
</tr>
</tbody>
</table>
JavaScript
$(document).ready(function() {
$("#button").click(function() {
var td=$(this).closest('table').attr('id');
alert(td);
});
});