Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Uncheck optional groups in targeted actions. That involves a wait until the groups appear as targeted actions are loaded with AJAX.
<!-- BEGIN script to uncheck optional groups in targeted actions. -->
<script type="text/javascript">
(function() {
var interval = null;
// uncheck the optional groups when they appear.
function actor() {
checkboxes = Array.from(document.querySelectorAll('#groups input[type=checkbox]'));
if (checkboxes.length > 0) {
checkboxes.forEach(function(e) { e.removeAttribute('checked'); })
if (interval != null) {
clearInterval(interval);
interval = null;
}
}
}
document.addEventListener('DOMContentLoaded', function() {
interval = setInterval(actor, 200);
});
})();
</script>
<!-- END script to uncheck optional groups in targeted actions. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.