Create Dependent Checkboxes With jQuery - ParentCheckBox

Create Dependent Checkboxes With jQuery - ParentCheckBox
File Size: 10 KB
Views Total: 1262
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

A jQuery plugin for dependent checkboxes that automatically check/uncheck a checkbox depending on the state of other related checkbox inputs.

A typical use of this plugin is to check/uncheck all child checkbox inputs once the parent checkbox is checked or unchecked.

How to use it:

1. Download and put the JavaScript file ParentCheckBox.plugin.js after jQuery.

<script src="" 
<script src="src/ParentCheckBox.plugin.js"></script>

2. Attach the plugin to the checkbox and pass the target checkbox parameter to the parentCheckBox function and done.

<input type="checkbox" name="test-1" id="elementOne" />
<label for="elementOne">
  Element 1

<input type="checkbox" name="test-2" id="elementTwo" />
<label for="elementTwo">
  Element 2

<input type="checkbox" name="test-3" id="elementThree" />
<label for="elementThree">
  Element 3

... more checkboxes here ...
$( document ).ready(function() {

  // more instances here


3. Customize the parent element.

  parentElement: null

4. Determine whether to disable the checkbox if checked.

  mandatory: true

This awesome jQuery plugin is developed by TIMDM. For more Advanced Usages, please check the demo page or visit the official website.