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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:59:58+00:00 2026-05-23T15:59:58+00:00

I want to improve this code http://jsfiddle.net/QmTNZ/30/ to use comma separated price in place

  • 0

I want to improve this code http://jsfiddle.net/QmTNZ/30/ to use comma separated price in place of the point

as you we can seem when we use for example 1 x 375,5 I get 375 in the Sum and not 375,5

My code:

function ca(){
    var $overall = 0;

    $("tr.sum").each(function() {

        var $qnt = $(this).find(".qty");
        var $price = $(this).find("td").eq(1);

        console.log($qnt + " | " + $price);

        var sum = parseFloat($price.text()) * parseFloat($qnt.val());

        if(isNaN(sum)) {
            sum = 0;
        }
        $(this).find("td").eq(2).text(Math.round(sum * 100) / 100);

        $overall += sum;

    });

    $("#total").text($overall);
}

$(function() {

    ca();
    $('input.qty').bind('change keyup',function(){ca();});

});
  • 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-23T15:59:59+00:00Added an answer on May 23, 2026 at 3:59 pm

    Change , to . before parsing the price and use .toFixed(2) to force 2 decimals at the results.

    working demo at http://jsfiddle.net/gaby/QmTNZ/38/

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

Sidebar

Related Questions

Can anyone help me to improve this code? I want to delete array if
I have this script: http://jsfiddle.net/NV2uV/ It works, but I do not like it. Cons:
i have code use googleseach API I want to use Thread to improve speed
This is my first post in stackoverflow. I want to improve its google pagerank
I'm following this tutorial here http://www.kriesi.at/archives/create-a-multilevel-dropdown-menu-with-css-and-improve-it-via-jquery on adding a menu with jquery. I've created
Live demo: http://jsfiddle.net/stapiagutierrez/KKdsb/29/ I'm just trying to create my own star rating UI for
I want to minimize the amount of code i have to write for this
I want to improve a small framework, and therefore I want to get rid
I work on the JBJF Project on SourceForge and we want to improve on
I am working on image processing library in c#. want to improve performance/speed and

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.