code messier than it should be

code messier than it should be

I have groups of check boxes. 
When a checkbox is ticked/unticked i want to check if any check boxes in the same group are checked.

I have the following HTML, this is dynamically generated so there could be any number of 'groups'



  1.         <div class="group">
  2.             <span class="title--bold">Time Found</span>
  3.             <span><input type="checkbox" name="vehicle" value="Bike"> Today</span>
  4.             <span><input type="checkbox" name="vehicle" value="Bike"> Yesterday</span>
  5.             <span><input type="checkbox" name="vehicle" value="Bike"> Last week</span>
  6.             <span><input type="checkbox" name="vehicle" value="Bike"> Never</span>
  7.         </div>

  8.         <div class="group">
  9.             <span class="title--bold">Animal Type</span>
  10.             <span><input type="checkbox" name="vehicle" value="Bike">Cats</span>
  11.             <span><input type="checkbox" name="vehicle" value="Bike">Dogs</span>
  12.         </div>
And this is my javascript

  1. $(document).ready(function () {
  2.         
  3.         $("input[type=checkbox]").on("click" ,function () {

  4.             console.log('mek');

  5.             var n = 0;

  6.             var rows = $(this).parent().parent().children('span');
  7.             
  8.             rows.each(function () {
  9.                 l = $(this).children('input:checked').length;
  10.                 n = n + l;
  11.             });

  12.             console.log(n);

  13.         });

  14.     });
To me it seams to be messier than it should be
What it does is find the . group element which the target input element belongs to and then counts the children which match the 'input:checked' selector.

Due to the fact that each 'input' is nested inside a 'span' (and so is not a direct child of .group using .parent().parent() is necessary to get the .group
Due to the fact that once we have .group the elements i am interested in are not direct children it is nessesary to use .each() 
And i have also had to store the matches in 'n' instead of using .length.

Is there any way this can be made shorter?

Perhaps the row "
var rows = $(this).parent().parent().children('span');" could become something like " var rows = $(this).parent().siblings() "

Is there any way the .each() can be removed?
Is there any way .length can be used instead of a counter (without removing the span tags)?