Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- BOOTSTRAP -->
- <link href="<?php echo base_url();?>assets/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet">
- <textarea id="output" placeholder="Klik disini"></textarea>
- <div class="modal fade inimodal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-lg">
- <div class="modal-content">
- <div class="modal-body">
- <table class="table table-bordered">
- <thead>
- <th><input type="checkbox" id="checkall"/></th>
- <th>Nama</th>
- </thead>
- <tbody>
- <tr>
- <td><input type="checkbox" class="chk" id="orang[1]" value="Abdul"/></td>
- <td>Abdul</td>
- </tr>
- <tr>
- <td><input type="checkbox" class="chk" id="orang[2]" value="Budi"/></td>
- <td>Budi</td>
- </tr>
- <tr>
- <td><input type="checkbox" class="chk" id="orang[3]" value="Cinta"/></td>
- <td>Cinta</td>
- </tr>
- <tr>
- <td><input type="checkbox" class="chk" id="orang[4]" value="Doni"/></td>
- <td>Doni</td>
- </tr>
- </tbody>
- </table>
- <button type="button" id="pilih" class="btn btn-primary">Selesai</button>
- </div>
- </div>
- </div>
- </div>
- <!-- JQUERY -->
- <script src="<?php echo base_url();?>assets/plugins/jquery/jquery-1.11.3.min.js"></script>
- <!-- BOOTSTRAP JS -->
- <script src="<?php echo base_url();?>assets/plugins/bootstrap/js/bootstrap.min.js"></script>
- <script>
- $(document).ready(function(){
- $("#output").click(function(){
- $(".inimodal").modal("show");
- });
- $("#checkall").change(function(){
- if(this.checked){
- $(".chk").each(function(){
- this.checked=true;
- });
- }else{
- $(".chk").each(function(){
- this.checked=false;
- });
- }
- });
- $("#pilih").click(function(){
- var str = [], item;
- $.each($('.chk:checked'), function (index, value) {
- item = $(this).val();
- str.push(item);
- });
- var selek=str.join(',');
- alert(selek);
- var output=str.join('\n');
- $("#output").text(output);
- $(".inimodal").modal('hide');
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement