Checked checkbox AdminLTE Bootstrap in Jquery

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.

 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.

/*
* 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 name When used
ifClicked user clicked on a customized input or an assigned label
ifChanged input’s checked, disabled or indeterminate state is changed
ifChecked input’s state is changed to checked
ifUnchecked checked state is removed
ifToggled input’s checked state is changed
ifDisabled input’s state is changed to disabled
ifEnabled disabled state is removed
ifIndeterminate input’s state is changed to indeterminate
ifDeterminate indeterminate state is removed
ifCreated input is just customized
ifDestroyed customization is just removed

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

$('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. 

Read more my bootstrap article here

The following two tabs change content below.
This site is a personal Blog of Sigit Prasetya Nugroho, a Desktop developer and freelance web developer working in PHP, MySQL, WordPress.

6 Comments

 Add your comment
  1. Thanks Man

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

  3. Life saver 🙂

  4. grazie non riuscivo a capire

Leave a Comment

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

%d bloggers like this: