title: jquery how to fill up an array
body: <p>i am in mobile app and i want to fill up an array with values from checkboxes.</p>
  
  <p>my code is</p>
  
  <pre><code>if (row.flatdescription == flatdescription) {
      if (row.receiptno == 0){
          items.push('&lt;input type="checkbox" name="code_'+ i +'" id="code_'+ i +'" value="' + row.amount + '" previous="' + row.pastpayments + '" barcode="' + row.barcode + '" todayp="' + row.todaypayments + '"/&gt;&lt;label for="code_'+ i +'"&gt;' + row.period +'..........'+ row.amount+'&lt;/label&gt;&lt;/br&gt;');
      }
      allbarcode[i] = row.barcode;
      previouspayments1 = previouspayments1 + row.pastpayments;
      previouspayments = previouspayments1.toFixed(2);
      sofeilon1 = sofeilon1 + row.amount;
      sofeilon = sofeilon1.toFixed(2);
      total1 = total1 + row.amount - row.pastpayments;
      total = total1.toFixed(2);
  }
  </code></pre>
  
  <p>and my array code</p>
  
  <pre><code>function barcodeTotal() {
      barcode = [];
      barcodeamount = [];
      barcodeprevious = [];
      $("input:checked").each(function(i) {
          barcode[i] = $(this).attr("barcode");
          barcodeamount[i] = $(this).attr("value");
          barcodeprevious[i] = $(this).attr("previous");
      });
  }
  </code></pre>
  
  <p>my goal is to fill barcode array like this</p>
  
  <pre><code>barcode [barcode: barcode, amount: value, previous: previous, ....
  </code></pre>
  
  <p>i will appreciate your answers</p>