Last active
January 3, 2016 08:19
-
-
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).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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");