[aur-dev] [PATCH] Show number of selected packages on search page
Marcel Korpel
marcel.korpel at gmail.com
Tue Jun 30 14:47:12 UTC 2015
* Johannes Löthberg <johannes at kyriasis.com> (Sun, 28 Jun 2015 21:22:05
+0200):
> +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;
> + }
> });
What Carsten said; you know you can also declare a function with
$(document).ready? That way, it isn't available outside of the function
and you don't clutter the global namespace, for what it's worth.
More information about the aur-dev
mailing list