• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
seegatesite header

Seegatesite.com

Seegatesite.com - Programming Tutorial , Sharing , How and Learn Together

  • TOOLS
    • Bootstrap Navbar Online Generator
    • Customize Sidebar Menu Bootstrap 3
    • Bootstrap Demo
  • ADVERTISE
  • CATEGORIES
    • Android
    • Blogging Tips
    • Database
    • CSS
    • Info Gadget
    • Javascript
    • Linux
    • PHP
    • Various
    • WordPress
  • Q&A
  • PHP
  • JAVASCRIPT
  • JQUERY
  • ANGULAR
  • WORDPRESS
  • SEO
  • REACT
🏠 » Javascript » Checked checkbox AdminLTE Bootstrap in Jquery

Checked checkbox AdminLTE Bootstrap in Jquery

By Sigit Prasetya Nugroho ∙ November 4, 2014 ∙ Javascript ∙ 7 Comments

Share : TwitterFacebookTelegramWhatsapp

Checked checkbox AdminLTE Bootstrap in JqueryAnyone having problems with javascript or jquery checkbox AdminLTE bootstrap framework ? Problems such as the onclick event is not working, checked method doesn’t work and others. Yes, I am one of those people who are confused using the checkbox on the framework.

Admin LTE is an absolutely stunning free Bootstrap dashboard theme from almsaeedstudio.  It is fully responsive and built on top of Bootstrap 3 . Read here for more information.

Table of Contents

    • 0.1  The problem that occurs is when we write the code in jquery or javascript, but the script can not run and there is no error in the checkbox adminLTE function . 
  • 1  Lets try my simple code below, how to use checkbox adminLTE dashboard framework. 

 The problem that occurs is when we write the code in jquery or javascript, but the script can not run and there is no error in the checkbox adminLTE function . 

The reason is javascript function that set the display of checkbox. That functions are located on the file AdminLTE / app.js at line 136.

1
2
3
4
5
6
7
8
9
/*
* We are gonna initialize all checkbox and radio inputs to
* iCheck plugin in.
* You can find the documentation at http://fronteed.com/iCheck/
*/
$("input[type='checkbox']:not(.simple), input[type='radio']:not(.simple)").iCheck({
checkboxClass: 'icheckbox_minimal',
radioClass: 'iradio_minimal'
});

It’s not a bug or error in checkbox adminLTE bootstrap, but we are less keen in using adminLTE framework. Checkbox and radio inputs in adminLTE using iCheck plugin. We can find the documentarion at http://fronteed.com/iCheck/

According fronteed.com, iCheck provides plenty callbacks, which may be used to handle changes.

Callback nameWhen used
ifClickeduser clicked on a customized input or an assigned label
ifChangedinput’s checked, disabled or indeterminate state is changed
ifCheckedinput’s state is changed to checked
ifUncheckedchecked state is removed
ifToggledinput’s checked state is changed
ifDisabledinput’s state is changed to disabled
ifEnableddisabled state is removed
ifIndeterminateinput’s state is changed to indeterminate
ifDeterminateindeterminate state is removed
ifCreatedinput is just customized
ifDestroyedcustomization is just removed

We need use on() method to bind them to inputs like example below :

1
2
3
$('input').on('ifChecked', function(event){
alert(event.type + ' callback');
});

ifCreated callback must be binded before plugin init.

Methods, these methods can be used to make changes programmatically (any selectors can be used).

$(‘input’).iCheck(‘check’); — change input’s state to checked
$(‘input’).iCheck(‘uncheck’); — remove checked state
$(‘input’).iCheck(‘toggle’); — toggle checked state
$(‘input’).iCheck(‘disable’); — change input’s state to disabled
$(‘input’).iCheck(‘enable’); — remove disabled state
$(‘input’).iCheck(‘indeterminate’); — change input’s state to indeterminate
$(‘input’).iCheck(‘determinate’); — remove indeterminate state
$(‘input’).iCheck(‘update’); — apply input changes, which were done outside the plugin
$(‘input’).iCheck(‘destroy’); — remove all traces of iCheck

 Lets try my simple code below, how to use checkbox adminLTE dashboard framework. 

[sociallocker id=”58″] 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<html>
    <head>
        <meta charset="UTF-8">
        <title>How to use checkbox event in adminLTE dashboard framework</title>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <link href="../css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="../font-awesome-4.1.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <link href="../css/AdminLTE.css" rel="stylesheet" type="text/css" />
    </head>
 
    <body class="skin-black">
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <aside class="right-side">
                <section class="content-header">
                    <h1>
                      How to use checkbox event in adminLTE dashboard framework
                    </h1>
                </section>
                <section class="content">
                <div class="box box-primary">
                               <div class="box-body">
                                       <h4>Default Category</h4>
                                       <div class="form-group">
                                       <textarea class="form-control" id="dataarray" disabled="disabled" rows="5" cols="50"></textarea>
                                          </div>
<div class="form-group">
                                              <div class="row">
                                                <?php
                                                $defcat=explode(",","google,bing,yahoo,ask.com,baidu,seegatesite.com");
                                              for($i=0;$i<count($defcat);$i++)
                                              {
                                                if($i==0){ echo '<div class="col-xs-8 col-md-2">'; }
                                                if($i==10){ echo '<div class="col-xs-8 col-md-2">'; }
                                                echo '<div class="checkbox"><label >';
                                                echo '<input type="checkbox" class="check" id="check_kat_'.$i.'" value="'.$defcat[$i].'"> '.$defcat[$i];
                                                echo '</label></div>';
if($i==9){ echo '</div>'; }
                                                if($i==19){ echo '</div>'; }
                                                if($i==count($defcat)){ echo '</div>'; }
                                              }
                                              ?>
                                              </div>
                                          </div><button id="checkallkat" onClick="check_all_kategori(<?php echo count($defcat)?>);" type="button" class="btn btn-primary" title="Check all">Check All</button>
                                          </div>
                                     </div>
 
                </div>
                </section>
            </aside>
        </div>
        <script src="../js/jquery.min.js"></script>
        <script src="../js/bootstrap.min.js" type="text/javascript"></script>
        <script src="../js/AdminLTE/app.js" type="text/javascript"></script>
        <script language="javascript">
function check_all_kategori(jumarray)
{
if (document.getElementById("checkallkat").innerHTML == "Check All")
{
for( var i=0;i<jumarray;i++)
{
$('.check').iCheck('check');
}
document.getElementById("checkallkat").innerHTML = "Uncheck All"
}else
{
for( var i=0;i<jumarray;i++)
{
$('.check').iCheck('uncheck');
}
document.getElementById("checkallkat").innerHTML = "Check All"
}
implode_kategori(jumarray);
}
 
$('.check').on('ifChanged', function(){
implode_kategori(6);
});
</script>
        <script>
function implode_kategori(jumarray)
{
var array=[];
var n=0;
for( var i=0;i<jumarray;i++)
{
check_name='check_kat_'+i.toString();
if(document.getElementById(check_name).checked == true)
{
array[n]=document.getElementById(check_name).value;
n = n+1;
}
}
var kat_join = array.join();
document.getElementById('dataarray').innerHTML=kat_join;
}
</script>
    </body>
</html>

[/sociallocker]

Read more my bootstrap article here

Another Javascript Related Post :

  • Tutorial Create Simple POS Using ReactJS And Laravel Lumen Part 1
  • Adept Using Datatables Plugin In 10 Minutes For Beginners (Tutorial)
  • The Using Of Reactstrap And React-Table, Suitable For Beginners
  • Tutorial Create Simple Block UI Using React JS
  • How To Implement Login Page And Protected Route ReactJS
  • Complete Tutorial React Router Dom For Beginners (Easy-To-Understand)

Avatar for Sigit Prasetya Nugroho

About Sigit Prasetya Nugroho

This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

Reader Interactions

Comments

  1. Avatar for Saw NerdarSaw Nerdar says

    November 12, 2014 at 2:36 am

    Thanks.

    Reply
  2. Avatar for Innam HunzaiInnam Hunzai says

    January 18, 2015 at 9:21 am

    Thanks Man

    Reply
  3. Avatar for BhanuBhanu says

    January 19, 2015 at 8:26 am

    Thanks for the article. Saved me lot of time. I just couldn’t figure out why jQuery for Checkbox was failing in Admin LTE.

    Reply
    • Avatar for Sigit Prasetya NugrohoSigit Prasetya Nugroho says

      January 31, 2015 at 8:56 am

      not failing, because checkbox in LTE not handle by jquery but handle in LTE script.

      Reply
  4. Avatar for MantasMantas says

    February 23, 2016 at 6:17 pm

    Life saver 🙂

    Reply
  5. Avatar for emilianoemiliano says

    October 19, 2016 at 11:26 pm

    grazie non riuscivo a capire

    Reply
  6. Avatar for SujashSujash says

    December 7, 2018 at 7:22 am

    any way to disable the iCheck plugin?

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Welcome to my Home,

Avatar for SujashThis site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.



Popular Articles

Checked checkbox AdminLTE Bootstrap in Jquery

November 4, 2014 By Sigit Prasetya Nugroho 7 Comments

Simple create date format validation with jqueryUI

December 21, 2014 By Sigit Prasetya Nugroho Leave a Comment

Create Simple Progress Bar for Fake Online Generator with Jquery

January 10, 2015 By Sigit Prasetya Nugroho Leave a Comment

22+ Coolest Free Jquery Plugin For Premium Theme

October 3, 2015 By Sigit Prasetya Nugroho Leave a Comment

Easy Build Your Anti Copy Paste Plugin

October 6, 2015 By Sigit Prasetya Nugroho Leave a Comment

Popular Tags

adminlte (15) adsense (13) adsense tips (4) affiliate amazon (13) amazon (12) Android (8) angular (16) angular 4 (12) angular 5 (4) asin grabber (3) Bootstrap (27) codeigniter (5) create wordpress theme (5) crud (8) css (6) free wordpress theme (7) google adsense (4) imacros (4) increase traffic (6) jquery (34) laravel (10) laravel 5 (5) learn android (5) lumen api (4) modal dialog (5) mysql (6) nodeJs (4) optimize seo (4) pdo (6) php (30) plugin (53) pos (8) Publisher Tips (5) react (4) Reactjs (7) SEO (37) theme (17) tutorial angular (5) tutorial angular 4 (6) tutorial javascript (10) tutorial javascript beginners (4) twitter (3) wordpress (18) wordpress plugin (13) XMLRPC (5)




  • About
  • Contact Us
  • Disclaimer
  • Privacy Policy
  • Terms and Conditions

©2021 Seegatesite.com