-
-
Save creativefull/fce0bc87dc676932c6f931e04ffe7c2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
$(".klik").click(function() { | |
console.log("Element di klik"); | |
$(this).closest("tr").find(".sub").toggle(); | |
}) | |
</script> | |
<div class="container col-lg-12"> | |
<div class="kotak"> | |
<center><h1>KATEGORI</h1></center> | |
<a href=""><button class="tambah"><i class="fa fa-print"></i> CETAK</button></a> | |
<table width="100%" > | |
<tr> | |
<td>NO</td> | |
<td>KATEGORI</td> | |
</tr> | |
<?php | |
$no = 1 ; | |
foreach ($db -> tampilkategori() as $lihatkat){ | |
?> | |
<tr> | |
<td><?php echo $no++; ?></td> | |
<td><button id="show" class="klik">KLIK</button><?php echo $lihatkat['nama_kategori']; ?></td> | |
</tr> | |
<?php $idkat = $lihatkat['id_kategori']; ?> | |
<?php foreach ($db -> tampilsubkategori($idkat) as $lihatsubkat) { | |
?> | |
<tr> | |
<td> | |
</td> | |
<td> | |
<ul> | |
<li class="sub"> | |
<?php echo $lihatsubkat['nama_subkat']; ?> | |
</li> | |
</ul> | |
</td> | |
</tr> | |
<?php | |
} | |
?> | |
<?php } ?> | |
</table> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment