I'm using jquery to hide all when document ready and when I'm click one of the btn-primary then will be show and hide in accordance with for each of row.
jquery
<script>
$(document).ready(function() {
$('#table').DataTable();
$('#formmasuk').hide();
$('.btn-primary').click(function() {
$('#formmasuk').show();
$('#buttonmasuk').hide();
});
});
</script?
html
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr style="center">
<th>Nik</th>
<th>Nama</th>
<th>Jabatan</th>
<th>Masuk</th>
<th>Keluar</th>
</tr>
</thead>
<tbody>
<?php foreach($query as $row):?>
<tr>
<td><?php echo $row->nik ?></td>
<td><?php echo $row->nama ?></td>
<td><?php echo $row->jabatan ?></td>
<td>
<div id='buttonmasuk'>
<a class="btn btn-sm btn-primary" href="javascript:void()"
title="Masuk" onclick="masuk('<?php echo $row->id_kar;?>')">Masuk</a></div>
<div id='formmasuk'>
<form>
<input type="text" name="pass">
</form>
</div>
<td>
<a class="btn btn-sm btn-danger" title="Keluar" ></i>
Keluar</a></td>
</tr>
<?php
endforeach ;?>
</tbody>
</table>
this image when document ready. why not all hidden? when I click one of the button masuk (class btn-primary) then show I want when clik click one of the button masuk (class btn-primary)then show and other still hidden