I have a table and I'm trying to create an action menu by right clicking on each row of the table.
It is partially working the problem that I can not make the script select the context menu for each line it is always catching the last.
I've created a fiddle to make it easier to test the script and I'll post the code below too:
<style type="text/css">
.skills {
background: #A6A6A5;
padding: 20px;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$("table").contextmenu({
delegate: "tbody tr",
menu: ".table tbody tr .skills:first-child"
});
});
</script>
<h1>Shao Kan Game World</h1>
<!-- Os dados na tabela são ficticios e nao tem intencao de insultar os personagens -->
<table class="table table-bordered table-hover table-striped" style="width: 500px; margin: 0 auto;">
<thead>
<tr>
<th>Personagem</th>
<th>Poder</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<tr>
<td>Luke</td>
<td>Espadinha</td>
<td class="skills">
<ul class="skills" style="display: none; z-index: 4000;">
<li>SABRE DE LUZ</li>
</ul>
</td>
</tr>
<tr>
<td>Robocop</td>
<td>Metralhadora</td>
<td class="skills">
<ul class="skills" style="display: none; z-index: 4000;">
<li>BAZUCAAAA</li>
</ul>
</td>
</tr>
</tbody>
</table>
What I need is when I click on Robocop
it will display the UL containing Bazuca
and when clicking on Luke
it will display Sabre de Luz
.