Seems like there is no core config to setup a "Check All" checkbox unless I missed where it is. I'm creating a content type and have a taxonomy reference field and I have alot of terms, which means alot of boxes I have to check. Anyway to provide a checkbox to select everything?

5 Answers 5


Here is an updated version of @duckx code, it has the following improvements :
- only select the checkboxes of the label that has been clicked
- allows to toggle checkboxes

Drupal.behaviors.selectAll = {
  attach: function (context, settings) {
    $('body.page-node .form-type-checkboxes > label').click(function() {
  • which file does Drupal.behaviros.selectAll go? Sep 27, 2013 at 1:02
  • I generally put this in a script.js inside my theme, don't forget to wrap it inside (function ($) { ... })(jQuery); as usual.
    – tostinni
    Sep 27, 2013 at 6:47

You can do a form alter. hook_form_alter and attach your js to the form.

$form['#attached']['js'] = array(
  drupal_get_path('module', 'YOURMODULE') . '/YOURMODULE.js',

Then add the code as in here


Here's a quick snippet for anyone looking for a quick check all functionality. It will basically make your field LABEL a check all button. No need to add any extra HTML elements or modules. This just works.

You can pretty much copy this into your js file and it will just work as i restrained it to working only on content Edit pages.

Obviously this isn't a long term solution, but mainly as a quick band aid patch.

jQuery(document).ready(function($) {
  var $checkBoxes = $('input[type="checkbox"]');
  $('body.page-node .form-type-checkboxes > label').click(function() {
      $checkBoxes.attr('checked', true);

This contrib module appears to do the trick: https://www.drupal.org/project/checkall


There is no core config option for something like this, it would have to be JavaScript/jQuery (http://jsfiddle.net/PtMrM/).

<a href="#" class="check-all">Check All</a>
<label><input type="checkbox" name="ny"> New York</label>
<label><input type="checkbox" name="bos"> Boston</label>
<label><input type="checkbox" name="sfo"> San Francisco</label>
<label><input type="checkbox" name="dc"> Wasington DC</label>
<script type="text/javascript">
  (function($) {
    var $checkBoxes = $('input[type="checkbox"]');
    $('.check-all').click(function() {
      $checkBoxes.attr('checked', true);

Please note, that is very quick js, and won't be very user friendly (e.g., they click on it, there is no way to uncheck)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.