4
I have a table and am trying to create an action menu by right clicking on each Row of the table.
It’s partially working the problem that I can’t make the script select the context menu for each row it’s always picking up the last one.
I created a fiddle to facilitate the testing of the script and I will post the code below as well:
<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 to click on the Robocop
it display the UL containing Bazuca
and when clicking on the Luke
he display the Sabre de Luz
.
vlw by @brasofilo edition!
– Trxplz0