I am using iCheck plugin for customizing checkboxes. I need to display certain text when one or more checkbox is checked and hide the text when none are checked.
The code I have currently displays the text on first click but doesn't hide it unless I click 2 more times. I have multiple checkboxes and would like to show text if one of 'em are checked else hide the text. Does anybody have any idea? The plugin has:
ifChecked
ifChanged
ifClicked
ifUnchecked
ifToggled
ifDisabled
ifEnabled.......
callbacks....Here is the plugin function
$('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
Here is what I tried..
$('input').on('ifChecked', function(event){
$(".hide").toggle();
});
html
<input type="checkbox">
<div class"hide" style="display:none">Hi there</div>
For those who struggle with this:
const value = $('SELECTOR').iCheck('update')[0].checked;
This directly returns true
or false
as boolean
.