Check/toggle ‘em all

February 10th, 2007. Tagged: bookmarklets, JavaScript, phpBB

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);
})()

Tell your friends about this post: Facebook, Twitter, Google+

74 Responses

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

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

  3. Thanks for this! Big help.

  4. Thanks!

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

  6. [...] 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. [...] 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. [...] the Bookmark from here. Via [...]

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

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

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

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

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

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

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

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

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

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

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

  20. [...] 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. cool bookmarklet, can this check/toggle function be included for user-selected area? (provided there are checkboxes within the selection)

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

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

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

  25. This works perfectly, 10/10

  26. 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. 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. Thanks, this is always a life saver when I have to work with 100′s of merchant accounts :P

  29. 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. Thanks, Just saved me hours deleting blog spam.

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

  32. 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. Rocks Dude, exactly what I was looking for, this bookmarklet is now in my toolbar.

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

    -Bronius

  35. 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. 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. [...] 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. [...] … via phpied.com [...]

  39. nice

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

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

  42. Thanks a lot for this superb solution

  43. 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. [...] 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. 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. Thanks so much! Appreciate it a whole bunch.

  47. 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. thank you :-)

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

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

  51. [...] 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. Thanks a lot for this brilliant code. It worked perfectly in IE 9 and saved me days of repettitive work!

  53. 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. Brilliant. <3

  55. Exactly what I was looking for. Props to you!

  56. Nice. Thanks!

  57. [...] 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. 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. 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. Damn this was helpfull, thanks!

  61. Hey, this is a great little script but I have run into a snag/bug. I’m attempting to use in a proprietary system that does not feature a “Select All” checkbox. The page opens in an internal frame (groan!) which does not allow tools like the Web Developer extension to check all of the extensive number of checkboxes. Found your script through Lifehacker and got really excited when it worked! Kind of. The boxes check, but when I click submit the site acts as though nothing was checked. Now, I know what you’re going to say: this sounds like a problem with the proprietary system. But this is where it gets weird. The behaviour is that when I use your script, all of the boxes get checked but the checkboxes don’t act as though they are! When you click on the box that is checked, it stays checked and then starts to toggle normally. It’s almost like the browser is just rendering the graphic for the checkmark, but doing nothing else. Any thoughts?

  62. Hello, nice ѕite you’ve got presently.

    Also visit my site Get More Information

  63. I am regular visitor, how are you everybody?
    This piece of writing posted at this site is genuinely good.

  64. [...] my new friend, Checktoggle ‘em All by Stoyan Stefanov, a simple php code/bookmark that ticks all of the boxes on a page and shaves [...]

  65. WOW! Very helpful! Thank you!

  66. If you wish for to improve your knowledge only keep
    visiting this web site and be updated with the most up-to-date gossip posted here.

  67. You can try this at home very frequently to get good results.

    First, partially our teeth’s color is influenced by our genes and also
    by the medicines that our mothers have taken during pregnancy.
    Some are paid, while others are free, but all will install over the air
    via your Wi-Fi or cellular connection.

  68. When a skill reaches the highest level members may obtain a skill cape to symbolize their achievement Woodcutting and fishing are skills through which
    people can obtain sources for polishing other skills such as fletching
    and cooking. If you buy the ingredients cheap and mix together, curry
    can be cooked for a large profit. Sign up is easy so
    hurry up and check us out today.

  69. Excellent website. Plenty of useful info here. I’m sending it
    to several buddies ans additionally sharing
    in delicious. And obviously, thank you on your sweat!

  70. It’s awesome to pay a quick visit this web site and reading the views of all colleagues on the topic of this paragraph,
    while I am also eager of getting familiarity.

  71. Thanks so much for this tool. You have saved me an incredible amount of tedious work. Cheers!

  72. Thank you sooooo much! You are a genius! I have 30000 spam posts to delete on a phphbb board and wasted hours deleting 5000 until I found this.

  73. Awesome mate!! Giving u 10 stars for this!!!!! Thanx a lot …

  74. There are many ways where you can learn how to create a faux headboard but if
    you don’t do it the right way things will not look proper leaving
    you with a bad headboard that you no longer want to use.
    Remember you measured enough to wrap the stuffing in the fabric.
    But in reality, unless you’re a skilled carpenter,
    you’re probably not going to be able to make one yourself.

Leave a Reply