Drupal.checkallAttach = function() { // Look for a form input id=checkall - the value of this field is an ID of a // container element, where a new checkall checkbox should be inserted. $('input#checkall').each(function() { $('#' + this.value).each(function() { $(this).html(''); }); }); } Drupal.checkAll = function(checked, form) { // TODO: just select checkboxes $(form.elements).each(function() { this.checked = checked; }); } if (Drupal.jsEnabled) { $(document).ready(Drupal.checkallAttach); }