Check/toggle ‘em all

Recently I decided to clean up all the spam from an abandoned phpBB forum of mine, there was a lot to delete. In the phpBB version that I use there is no option to "check all" topics you want to moderate. So I came up with a little bookmarklet to do this for me. Here it is, only improved to work within frames and toggle (check if not checked, uncheck otherwise) all checkboxes in sight. Tested in FF and IE6/7.

To install, add this to your bookmarks/favourites:

Toggle 'em all

Here are
some checkboxes for your testing pleasure.

The reading friendly code:

javascript:(function(){
function checkFrames(w) {
 
  try {
    var inputs = w.document.getElementsByTagName('input');
    for (var i = 0; i < inputs.length; i++) {
      if (inputs[i].type && inputs[i].type == 'checkbox'){
        inputs[i].checked = !inputs[i].checked;
      }
    }
  } catch (e){}
  if(w.frames && w.frames.length>0){
    
    for(var i = 0; i < w.frames.length;i++){
      var fr = w.frames[i];
      checkFrames(fr);
    }
  }
}
checkFrames(window);
})()

This entry was posted on Saturday, February 10th, 2007 and is filed under bookmarklets, JavaScript, phpBB. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


Get notification for future posts: follow me on Twitter or subscribe to my RSS feed

60 Responses to “Check/toggle ‘em all”

  1. unwiredbrain Says:

    Why don’t you provide a sort of test page?

  2. Stoyan Says:

    yes, good idea. I’ll add a few check boxes in this post.

  3. Paul Says:

    Thanks for this! Big help.

  4. Mike Says:

    Thanks!

  5. Gunther Says:

    Wow!… I needed this last night! It works! Kinda spooky!

  6. Toggle Em All Bookmarklet Makes Check Box Checking Comfortable Says:

    [...] install it simply go to the Toggle Em All website. You have the option to drag and drop the bookmarklet to the bookmark’s toolbar or to [...]

  7. Bookmarklet To Toggle All Checkboxes Says:

    [...] drag the bookmarklet from the Check/toggle ‘em all page to your browser bookmarks bar and click on it whenever you want to toggle between [...]

  8. Selecting / Toggle all check boxes in a click Says:

    [...] the Bookmark from here. Via [...]

  9. Toggle ‘Em All Makes Check Boxes Hassle Free [Bookmarklet] · TechBlogger Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via [...]

  10. Marc Says:

    Awesome, been looking for something like this for a while, to clean up an old guestregistration website. Thanks a bunch!

  11. McColley.net » Blog Archive » Toggle ‘Em All Makes Check Boxes Hassle Free [Bookmarklet] Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via [...]

  12. infoyourway.com » Toggle ‘Em All Makes Check Boxes Hassle Free [Bookmarklet] Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via [...]

  13. free Toggle ‘Em All Makes Check Boxes Hassle Free [Bookmarklet] | 82123 Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via [...]

  14. Toggle ‘Em All Makes Check Boxes Hassle Free [Bookmarklet] | Techno Portal Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via [...]

  15. Toggle ‘Em All Makes Check Boxes Hassle Free | Lifehacker Australia Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via gHacks] Tagged:bookmarkletstime [...]

  16. Toggle ‘Em All Makes Check Boxes Hassle Free [Bookmarklet] - 1443th Edition | Technology Revealed Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via [...]

  17. Toggle ‘Em All Makes Check Boxes Hassle Free [Bookmarklet] | Feed Reader Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via [...]

  18. links for 2009-04-20 « Amy G. Dala Says:

    [...] Check/toggle ‘em all / phpied.com [...]

  19. The Far Edge » Blog Archive » Toggle ‘Em All Makes Check Boxes Hassle Free [Bookmarklet] Says:

    [...] without the bloat of extensions, make sure to check out our roundup of must handy bookmarklets. Toggle ‘Em All [via [...]

  20. links for 2009-04-21 | Boost Ventilator Says:

    [...] Check/toggle ‘em all / phpied.com (tags: checkbox toggle javascript bookmarklet) This entry was posted in Boostmarks. Bookmark the permalink. Comments are closed, but you can leave a trackback: Trackback URL. « links for 2009-04-17 [...]

  21. lanux128 Says:

    cool bookmarklet, can this check/toggle function be included for user-selected area? (provided there are checkboxes within the selection)

  22. Lito | TheFilipinoEntrepreneur.Com Says:

    Thanks! that was very cooool! I didn’t know there were such kind of javascript. Thanks!

  23. MogBlog » Blog Archive » Bookmarklet to toggle all checkboxes on a webpage Says:

    [...] link Leave a Reply [...]

  24. Chris Says:

    This is an awesome feature. Much better than going through the hassle of installing an addon. Thanks :)

  25. dchizzle Says:

    This works perfectly, 10/10

  26. belg4mit Says:

    For a more robust version, change =checked to .click()
    This will trigger any events associated with the form elements for some
    (ill-conceived) forms, at the expense of a potentially large delay.

  27. otto Says:

    Thanks for this tool.

    It works great and saved me a lot of time selecting contacts in my e-mail program.(which should have had a “select all” function, but they somehow forgot to add)

    Otto

  28. Chris Walters Says:

    Thanks, this is always a life saver when I have to work with 100′s of merchant accounts :P

  29. Anthony Says:

    Thanks for this. I knew there had to be a way to go around websites/forms that won’t let you select all. This will save me hours over a year.

  30. Paul Says:

    Thanks, Just saved me hours deleting blog spam.

  31. Just found an even smaller example of doing so . . . – Education Compendium Says:

    [...] http://www.phpied.com/checktoggle-em-all/ [...]

  32. Chanel bags Says:

    Smashing wordpress web log here . . It’s difficult to find lineament writing like yours these clarence shepard day jr.. I genuinely prize peoples like you! take care and see you soon ….

  33. Justin Germino Says:

    Rocks Dude, exactly what I was looking for, this bookmarklet is now in my toolbar.

  34. Bronius Says:

    Thanks for sharing! Works great in Drupal development where you have a screen full of checkboxes.

    -Bronius

  35. timtak Says:

    I thought that this was the answer, but for me I would like a *check* them all bookmarklet,
    rather than toggle them all. The pages below claim to provide a check all bookmarklet
    http://www.aeonscope.net/2010/05/25/jquery-check-all-bookmarklet/
    http://en.gibney.org/bookmarklets
    but in fact they toggle too. Is there a way to check all, rather than toggle all?

  36. Nelson Says:

    This seems to work well, fine on your test page. But, how do I use it. All i can do is toggle the test page.

  37. Use UnTweeps to Unfollow Inactive Twitter Users | Dragon Blogger Says:

    [...] However, there are some plugins for Firefox like CheckFox or even a bookmarklet you can use called Toggle Em All which will auto checkmark every single box on the page so you can mass unfollow the inactive [...]

  38. Check/toggle ‘em all-If you’re going to use ManageFlitter, you’re going to need this « Collin Condray's WordPress.com Blog Says:

    [...] … via phpied.com [...]

  39. mikedesta Says:

    nice

  40. Brad Says:

    Wow thanks for this. Saved me a ton of time!

  41. Matyko Says:

    Thank You Very Much, you saved me a lot of time with this smart tool! ;) Keep up the good work dude! ;)

  42. Mukesh Dak Says:

    Thanks a lot for this superb solution

  43. Akanaro Says:

    Thank you, thank you, thank you. I was geting frustrated because a part of my job requires me to select thousands of items on a web interface limited to 15 items per page and delete them. With no select all function! This makes it just so much easier.

  44. The Shelfari Data Jail « Linear Fix Says:

    [...] books from Shelfari. Going to the list view of your books (you must be logged-in) then using the Check/toggle ‘em all bookmarklet to select remove all books, in the list view, is the fastest way to delete books from your Shelfari [...]

  45. Timtak Says:

    Thank you for the bookmarklet. But I would still be interested to find a check them all bookmarklet to check all the boxes on the page even if some are already checked.

  46. Amanda Frenc Says:

    Thanks so much! Appreciate it a whole bunch.

  47. Joel D. Reid Says:

    To have it check all instead (after which you could use Toggle ‘Em All to uncheck everything),
    1. Bookmark it again, then go to it in your browser’s bookmark organizer/editor.
    2. Edit the bookmark name (“Check ‘Em All” perhaps?)
    3. Edit the bookmark url, which is tightly packed javascript. Don’t be intimidated, just look for the only exclamation point and change just “!inputs[i].checked” to “true”. You’re only editing between the %20 and the semicolon.
    This works by making each box’s checkedness true, rather than flip. Cheers.

  48. Mithun Says:

    thank you :-)

  49. Tom Says:

    Thanks so much. i have been searching for “all check” function. thanks !

  50. VRT Says:

    Thanks for publishing this, it saved me a lot of time!

  51. How do I mass select checkboxes in a web-browser? - Quora Says:

    [...] in a web-browser?Post    Bahaa' Awartany, InternetierHere is a simple solution http://www.phpied.com/checktoggl…A bookmarklet that can do it for you.Comment Loading… • Post • 12:41am  Add [...]

  52. Tony Says:

    Thanks a lot for this brilliant code. It worked perfectly in IE 9 and saved me days of repettitive work!

  53. Chuck Renner Says:

    I was using a site that was looking for javascript click events on the checkboxes. The bookmarklet as it was did not work on this site. So I wrote a couple of variants. The first variant uses the javascript click() function on every checkbox (effectively toggling every checkbox, but in a way that is compatible with raising the click events. The second variant only runs click() on checkboxes that are currently unchecked (effectively turning every checkbox to the checked state, also in a way that is compatible with raising the click events. Here they are:
    toggleAll:
    javascript:javascript:(function(){function checkFrames(w) {try {var inputs = w.document.getElementsByTagName(‘input’);for (var i=0; i 0){for(var i=0;i<w .frames.length;i++){var fr=w.frames[i];checkFrames(fr);}}}checkFrames(window);})()
    checkAll:
    javascript:javascript:(function(){function checkFrames(w) {try {var inputs = w.document.getElementsByTagName('input');for (var i=0; i 0){for(var i=0;i<w .frames.length;i++){var fr=w.frames[i];checkFrames(fr);}}}checkFrames(window);})()

  54. Phil H Says:

    Brilliant. <3

  55. Peter Says:

    Exactly what I was looking for. Props to you!

  56. Ken Says:

    Nice. Thanks!

  57. Tips And Tricks: How To Delete Multiple Tweets At Once Click (Additional Using Javascript) | Corofelweb Says:

    [...] to  http://www.phpied.com/checktoggle-em-all/ . The article tell you how to check the checkbox by using Javascript. You need to drag [...]

  58. Ramsay Says:

    Thanks for the Toggle All bookmark-let. Simple yet very useful to toggle all checkboxes on a page. A big time saver, I say.

  59. niche targeted guest posts Says:

    It’s actually very complex in this busy life to listen news on Television, so I simply use internet for that purpose, and get the most recent news.

    my web page; niche targeted guest posts

  60. Dylan Says:

    Damn this was helpfull, thanks!

Leave a Reply