Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7491811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:10:47+00:00 2026-05-29T16:10:47+00:00

i am in mobile app and i want to fill up an array with

  • 0

i am in mobile app and i want to fill up an array with values from checkboxes.

my code is

if (row.flatdescription == flatdescription) {
    if (row.receiptno == 0){
        items.push('<input type="checkbox" name="code_'+ i +'" id="code_'+ i +'" value="' + row.amount + '" previous="' + row.pastpayments + '" barcode="' + row.barcode + '" todayp="' + row.todaypayments + '"/><label for="code_'+ i +'">' + row.period +'..........'+ row.amount+'</label></br>');
    }
    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);
}

and my array 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");
    });
}

my goal is to fill barcode array like this

barcode [barcode: barcode, amount: value, previous: previous, ....

i will appreciate your answers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:10:48+00:00Added an answer on May 29, 2026 at 4:10 pm

    You can transform your checked input fields into an array easily:

    var checkedInputs = $("input:checked") // this contains the raw HTML-Elements
    

    Now, depending on the desired result you may either harvest the values separately

    var barcodes  = checkedInputs.map(function() { return $(this).attr('barcode')  })
    var amounts   = checkedInputs.map(function() { return $(this).attr('amount')   })
    var previouss = checkedInputs.map(function() { return $(this).attr('previous') })
    

    or, what might be even better, as objects just like twilson suggested

    var results = checkedInputs.map(function() {
      return {
        barcode:  $(this).attr('barcode'),
        amount:   $(this).attr('amount'),
        previous: $(this).attr('previous')
      }
    })
    

    In this case you want the this to be taken from inside of the function call,
    as it refers to the object, you matched with the $('input:checked') call.
    If you store var self = this as twilson suggested, you would not receive the actual values of the input box, but no values, as the this of the calling context is most likely not an HTMLElement at all.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to upload photos from Android's mobile gallery from my app. How can
i am in mobile app and i want to create dynamicaly list of checkboxes
In my mobile app, I want to load all images from an arraylist of
In my jQuery mobile app, I want to display the result from a web
I want to build my first mobile app. I am wondering if I should
I want to deveplop an app for Windows Mobile 5.0 and above that can
i want to create a chat app using flex 4.5 mobile project for android
I want to integrate Facebook with my Birthday App, so I started https://developers.facebook.com/docs/mobile/android/build/ working
I want a simple mobile app to be able to read a public facebook
hi I just finished designing a mobile web app and now want to start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.