[aur-dev] [PATCH] Show number of selected packages on search page

carstene1ns arch at carsten-teibes.de
Tue Jun 30 14:15:29 UTC 2015


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-dev/attachments/20150630/7af5e82d/attachment.asc>


More information about the aur-dev mailing list