Bookmarklet for a Real Imaginary Friend

I have a large community of online parents, and we’ve take to calling each other “Real Imaginary Friends.”  Many of us have never met in person, but we’ve been supporting one another for years with our friendship, advice, and a huge assortment of talents.  One of these friends was frustrated with the lack of a “check all” button on her kid’s online school assignment and attendance tracker, so I did some quick problem solving.

These instructions are for Chrome, but they should work in other browsers too. This was a quick and dirty project, and testing was minimal. Your mileage may vary:

    1. Right-click the bookmarks bar and select the option for “Add page…”
    2. Give it any name you like, ex: Toggle Checks.
    3. Copy this bit of code into the Url field:javascript:(function(){var inputs=document.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].type=='checkbox'){inputs[i].checked=!inputs[i].checked;}}})();
    4. Click “Save.”

Now, when you load a webpage that has a bunch of checkboxes without a “check all” button, all you need to do is click the bookmarklet to check/uncheck everything!

Note: this will reverse the current state of any boxes on the page.  If you checked a box, then click the bookmark, it will uncheck that box while checking all the other and vice versa.