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 6561601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:36:30+00:00 2026-05-25T13:36:30+00:00

I have an array called prices and another called orderT I want to check

  • 0

I have an array called prices and another called orderT I want to check if it’s of a certain orderType then I do certain transactions with prices[i] if it’s a different type then another transaction (only 2 types of orders).

So far I can iterate through prices (using accounting.js plugin):

function processTotal(){
        var prices = $('.prices');
        var orderT = $('.orderType');
        var total = 0;
        $.each(prices, function(i, e){
            total += accounting.unformat(prices[i].textContent);
        });

        total = parseFloat(total);
        $('#sum').text(accounting.formatMoney(total, "€", 2, ".", ","));
    }

the prices part works very well, but I can’t figure how to also go over the orderT to check.

EDIT

orderT and prices are related and are in a table, I can’t post all the table as it is quite big but it’s basically:

<td>order_type</td>
<td>$00.00</td>
  • 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-25T13:36:31+00:00Added an answer on May 25, 2026 at 1:36 pm

    Try this(assuming the number of .prices is same as .orderType):

    $.each(prices, function(i, e){             
        var orderType = orderT [i];
        if(orderType.textContent == "2"){
            //Do Something
        } else {
            //total += accounting.unformat(prices[i].textContent);         
            //Do Something
        }
    }); 
    

    Looks like the .price and .orderType are related. If you can post the HTML, this code can be improved to use the siblings/other selectors to access .price and corresponding .orderType

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

Sidebar

Related Questions

Specifically, I have an array of strings called val, and want to replace all
Let's say i have an array called teams . I want to plan matches
I have an array list called str, i want to see how many elements
I have an array list called str, i want to see the elements inside
I have an array called $times . It is a list of small numbers
Say I have an array of strings in a php array called $foo with
I have a pretty simple problem. Basically I have an array called $list that
I have an array of objects in MATLAB and I've called their constructors in
Say I have a 2D array of random boolean ones and zeroes called 'lattice',
I have an app holding an array of instances of a class called SwimmingPool.

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.