« on: April 12, 2020, 08:39:14 PM »
 |
|
 |
 |
Rumus ini digunakan untuk meng-hide atau menyembunyikan secara otomatis data yang telah ditampilkan jika button DIV di click. Sample: Button DIV1 -> click -> Result DIV1 -> Hide Result DIV2,3,4,5... Button DIV2 -> click -> Result DIV2 -> Hide Result DIV1,3,4,5... ....... <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script> $(document).ready(function(){ $("span").click(function(e){ $('[id^="r">').not($('#r'+$(this).attr('id')+'')).hide(); $('#r'+$(this).attr('id')+'').show() }); }); </script>
<span id="1open">R1</span> <span id="2open">R2</span> <span id="3open">R3</span> <span id="4open">R4</span> <span id="5open">R5</span>
<div style="display:none" class="hide_show" id="r1open">R11111</div> <div style="display:none" class="hide_show" id="r2open">R22222</div> <div style="display:none" class="hide_show" id="r3open">R33333</div> <div style="display:none" class="hide_show" id="r4open">R44444</div> <div style="display:none" class="hide_show" id="r5open">R55555</div>
|
|
 |
|
 |