Am 28.06.2015 um 21:22 schrieb Johannes Löthberg:
+function checkboxes() { + document.getElementById("pkglist-checked-count").innerHTML = document.querySelectorAll('input[type="checkbox"]:checked').length; +} + $(document).ready(function() { collapseDependsList("#pkgdepslist"); collapseDependsList("#pkgreqslist"); collapseDependsList("#pkgsrcslist"); + checkboxes(); // Set initial value + + var elements = document.getElementsByClassName('package-checkbox'); + + for (var i = 0, len = elements.length; i < len; i++) { + elements[i].onchange = checkboxes; + }
It should be easier to just use the already active jQuery. See the first example here: https://api.jquery.com/checked-selector/ That said, $(".package-checkbox:checked").length should do it. best regards, carstene1ns