jquery.plugInReflector.js

jQuery addIn reflectStatusOn

If you need some checkboxes to "follow" the state of another checkbox, or a checkbox should reflect its status on other checkboxes, here is the addIn for you.

reflectStatusOn(sSelector, options)

reflectStatusOn is a jQuery addIn which will bind rules to selectboxes which will ensure that other checkboxes are the same, or inversed.

Use

jQuery([selector for controling checkbox]).reflectStatusOn([selector for checkboxes to controle][, {inverse:[false]}]);

The option "inverse" defaults to false, which will have the effect that the status of controling checkbox will be reflected onto the controled checkboxes.
If you choose inverse: true the controled checkboxes will get the reversed/inversed value of the controling checkbox.

jQuery('#chk0').reflectStatusOn('#chk1, #chk2');

chk0 reflects its checked status onto chk1 and chk2




jQuery('#chk4').reflectStatusOn('#chk5', {inverse: true});

chk4 reflects its inverted checked status onto chk5




Code

You can get the addIn here: jquery.reflectStatusOn.js

code.netsi.dk