Welcome Guest, Not a member yet? Register   Sign In
checkbox color for 2 set
#1

i have task like 2 set of checkboxex . first set is core having one color. second set having different color . each set have select all checkbox also. I attached my out put screen look like that.

my view file

core (select all) and subcode
****
<td align="center"> <?php echo $rowc['subcode']; ?> <input type="checkbox" id='check-all' onClick="toggle(this,<?php echo $rowc['markid'] ?>)" value="<?php echo $rowc['markid']; ?>" checked="checked" >
</td>

elect (select all) and subcode
****
<td align="center"> <?php echo $rowe['subcode']; ?> <input type="checkbox"    id="check-all2"  onClick="toggle(this,<?php echo $rowe['markid'] ?>)" value="<?php echo $rowe['markid']; ?>"  >
</td>

--------------------------------------------------------------------------------------------------
within datatables   (set1)
**************
<td align="center"> <input type="checkbox" class="check" name="friend_id[]"
value="<?php echo $row1['markid'];?>" >

within datatables   (set2)

<td align="center"> <input type="checkbox" class="check"   name="friend_id[<?php echo $row2['markid'];?>]" value="<?php echo $row2['markid']; ?>" /> </td>


checkbox color and select all coding
*****************************
<script src="<?php echo base_url(); ?>assets/js/addUser.js" type="text/javascript"></script>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="<?= base_url('assets/plugins/iCheck/icheck.min.js') ?>"></script>
<script>
var triggeredByChild = false;

$('input').iCheck({
    checkboxClass: 'icheckbox_square-green',
    //radioClass: 'radio-default',
    increaseArea: '25%'
});

$('#check-all').on('ifChecked', function (event) {
    $('.check').iCheck('check');
    triggeredByChild = false;
});

$('#check-all').on('ifUnchecked', function (event) {
    if (!triggeredByChild) {
        $('.check').iCheck('uncheck');
    }
    triggeredByChild = false;
});
// Removed the checked state from "All" if any checkbox is unchecked
$('.check').on('ifUnchecked', function (event) {
    triggeredByChild = true;
    $('#check-all').iCheck('uncheck');
});

$('.check').on('ifChecked', function (event) {
    if ($('.check').filter(':checked').length == $('.check').length) {
        $('#check-all').iCheck('check');
    }
});

not working properly. need help. 
I include
<link rel="stylesheet" href="<?= base_url('assets/plugins/iCheck/square/green.css') ?>">
<link rel="stylesheet" href="<?= base_url('assets/plugins/iCheck/square/red.css') ?>">

problems. 
1,select all not working. if i select first row(select all) it checks all checkboxes
2, second set color not working

Attached Files Thumbnail(s)
   
Reply




Theme © iAndrew 2016 - Forum software by © MyBB