Collapsible Checkbox Tree jQuery Plugin

Wednesday August 24th, 2011

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.

Example

Collapsible Checkbox Tree Example

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'

     });
});

0 comments - add your own