Collapsible Checkbox Tree jQuery Plugin
Wednesday 11th November, 2009
This plugin for jQuery takes a standard nested hierarchy of checkboxes, and turns them into a collapsible tree.
There are one or two similar plugins floating around on the web, but none that worked exactly as we needed for a recent project.
Creating our own purpose-built plugin was the only way to go, and here are the results.
Demo
Useage
The plugin can be called in the usual way :
jQuery(document).ready(function(){
$('ul#example').collapsibleCheckboxTree();
});
There are also a handful of options :
jQuery(document).ready(function(){
$('ul#example').collapsibleCheckboxTree({
// When checking a box, all parents are checked (Default: true)
checkParents : true,
// When checking a box, all children are checked (Default: false)
checkChildren : false,
// When unchecking a box, all children are unchecked (Default: true)
uncheckChildren : true,
// 'expand' (fully expanded), 'collapse' (fully collapsed) or 'default'
initialState : 'default'
});
});
Download
Download Collapsible Checkbox Tree (zipped, 24KB)
Release Notes
4th Jan 2010
1.0.1 – Bug fix – Clicking the three expand/contract state buttons resulted in the form being unexpectedly submitted when used within a form.
11th Nov 2009
1.0 – Initial release