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

  • Home
  • SEARCH
  • 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 8799505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:20:32+00:00 2026-06-14T00:20:32+00:00

I have a huge form with several input fields. This is a Balance and

  • 0

I have a huge form with several input fields. This is a Balance and a Profit & Loss sheet, so the input text fields has to be formatted as “money”. I found some nice jQuery plugin to do the formatting: accounting JS, but right now I have to call it manually on all the fields and this is not the best method I think…

How can I call the accounting.formatMoney() function on ALL the input text fields on keydown?
So if there is a KeyDown or KeyUp event on the FORM or BODY, the script will find ALL the input fields and execute the script.

This is the formatting and the Javascript function I want to call on every INPUT text field:

var options = {
    symbol : "",
    thousand: " ",
    precision : 0,
    format: "%v%s"
};

var tmp = parseInt(document.getElementById('input_id').value, 10);
document.getElementById('input_id').value = accounting.formatMoney(tmp, options);

The form is sent back to BODY via AJAX, so I think the best method would be to call the function this way:

    $(document).ready(function(){
        $('body').on('keyup', 'input', function(e){
                    // collect all input fields and execute the function
        });
    });

Thank you very much for the help!

  • 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-06-14T00:20:33+00:00Added an answer on June 14, 2026 at 12:20 am

    You might do

    $(document).ready(function(){
        $('body').on('keyup', 'input', function(){
                $(this).val(accounting.formatMoney($(this).val(), options));
        });
    });
    

    But this supposes your users would like the input to be modified while they’re typing.

    If you want to have the input modified when the users leave the field or type ‘enter’, do this :

    $(document).ready(function(){
        $('body').on('blur change', 'input', function(){
                $(this).val(accounting.formatMoney($(this).val(), options));
        });
    });
    

    Note that in a real world application I would have a class on my inputs to make the selector more selective ('input.money' instead of 'input').

    EDIT :

    If you want to apply this to the inputs in a table whose id is bstable, do

    $(document).ready(function(){
        $('#bstable').on('blur change', 'input', function(){
                $(this).val(accounting.formatMoney($(this).val(), options));
        });
    });
    

    If the bstable table is obtained via ajax and isn’t immediately here, you may do

    $(document).ready(function(){
        $(document.body).on('blur change', '#bstable input', function(){
                $(this).val(accounting.formatMoney($(this).val(), options));
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a huge form with at least 200 input fields- text/radio/checkboxes . I
I have a huge form that has around 110 fields columns (single row) that
I have a huge ASPX web form which has around 100 fields which need
I have a vaadin form with huge number of fields in it(textbox, select box
I have a huge database that has several tables that hold several million records.
I have a huge form (for an internal CMS) that is comprised by several
I have a huge text file of form data is saved in directory data/data1.txt,
assume i have a huge input form, which of course representing classes. i need
I have a huge formatted file of the form: 29/01/2010 18:00 string1 string2 .....
I have a huge text file and I wanted to write a program which

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.