Skip to content

Instantly share code, notes, and snippets.

@cssimsek
Last active January 3, 2016 08:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cssimsek/8434911 to your computer and use it in GitHub Desktop.
Save cssimsek/8434911 to your computer and use it in GitHub Desktop.
Select or deselect all checklist items present on a page (for example history items on chrome://history-frame). When invoking checkAll, the argument checkVal should be set to "true" to check all, and "false" to deselect (uncheck).
function checkAll(checkVal){
var removeMult = document.getElementById("remove-selected");
removeMult.removeAttribute("disabled");
var c = [];
c = document.getElementsByTagName('input');
console.log(c);
for (var i = 0; i < c.length; i++)
{
if (c[i].type == 'checkbox')
{
c[i].checked = checkVal;
}
}
};
// pass "true" in order to check all
checkAll(true);
@cssimsek
Copy link
Author

When on chrome://history-frame also add the below to enable the "Remove selected items" button:
var removeMult = document.getElementById("remove-selected");
removeMult.removeAttribute("disabled");

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