check element is in table
by Yusril Maulidan Raji
HTML
<script src="https://code.jquery.com/jquery-1.7.2.min.js"></script>
<div id="test">
<table id="table" border="1">
<thead style='font-family: "Lucida Console";'>
<tr>
<th style="height: 100px;width: 100px">asdasda</th>
<th style="height: 100px;width: 100px"></th>
</tr>
</thead>
<tbody style='font-family: "Lucida Console";'>
<tr>
<td style="height: 100px;width: 100px">asadsas</td>
<td style="height: 100px;width: 100px"></td>
</tr>
</tbody>
</table>
</div>
JavaScript
$(document).bind("contextmenu", function (event) {
console.log($(event.target).closest('table').attr('id'));
});