Skip to content

Instantly share code, notes, and snippets.

@mpnordland
Created February 3, 2014 17:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mpnordland/8788021 to your computer and use it in GitHub Desktop.
Save mpnordland/8788021 to your computer and use it in GitHub Desktop.
Bookmarklets to quickly check and uncheck checkboxes
Check all
javascript:(function(){$('input[type="checkbox"]').attr('checked',true);})();
Uncheck all
javascript:(function(){$('input[type="checkbox"]').attr("checked",false);})();
These require jQuery, non jQuery versions welcome
Designed to cope with Drupal (TM)
@alexander-tissen
Copy link

alexander-tissen commented Sep 26, 2018

// Check all checkboxes
Array.prototype.slice.call( document.querySelectorAll( 'input[type="checkbox"]' ) ).forEach( checkbox => checkbox.checked = true );
// Uncheck all checkboxes
Array.prototype.slice.call( document.querySelectorAll( 'input[type="checkbox"]' ) ).forEach( checkbox => checkbox.checked = false );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment