How to format amount on keyup with toLocaleString ? using minimumFractionDigits?How do JavaScript closures work?How to horizontally center a <div>?How can I format numbers as currency string in JavaScript?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do I find out which DOM element has the focus?How do I redirect to another webpage?How to check whether a checkbox is checked in jQuery?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

Double redundancy for the Saturn V LVDC computer memory, how were disagreements resolved?

changing number of arguments to a function in secondary evaluation

I accidentally overwrote a Linux binary file

How are you supposed to know the strumming pattern for a song from the "chord sheet music"?

Which I-94 date do I believe?

Best gun to modify into a monsterhunter weapon?

Can you castle with a "ghost" rook?

Is it okay for a ticket seller to grab a tip in the USA?

Are there any financial disadvantages to living significantly "below your means"?

Understanding the point of a kölsche Witz

How can you evade tax by getting employment income just in equity, then using this equity as collateral to take out loan?

Is TA-ing worth the opportunity cost?

What game uses dice with sides powers of 2?

Extremely casual way to make requests to very close friends

Tikzpicture - finish drawing a curved line for a cake slice

Simple Stop watch which i want to extend

Why is transplanting a specific intact brain impossible if it is generally possible?

What are the advantages and disadvantages of Wand of Cure Light Wounds and Wand of Infernal Healing compared to each other?

What does this double-treble double-bass staff mean?

What costs less energy? Roll or Yaw?

Team goes to lunch frequently, I do intermittent fasting but still want to socialize

Dropdowns & Chevrons for Right to Left languages

Christian apologetics regarding the killing of innocent children during the Genesis flood

Y2K... in 2019?



How to format amount on keyup with toLocaleString ? using minimumFractionDigits?


How do JavaScript closures work?How to horizontally center a <div>?How can I format numbers as currency string in JavaScript?How do I check if an element is hidden in jQuery?How do I remove a property from a JavaScript object?How do I find out which DOM element has the focus?How do I redirect to another webpage?How to check whether a checkbox is checked in jQuery?How to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm trying figure out a way to format in live an amount of an input box with local's 'it-IT' and minimumFractionDigits of > 2.



This is my code https://jsfiddle.net/oLgtwjfr/



$(document).on('keyup', '#inputKeyupExample', function(event) 

var $this = $( this )
var elementThis = this
var input = $this.val()

$this.val(formatNumber(parseInt(input)))
)
function formatNumber(x)
return x.toLocaleString("it-IT",
minimumFractionDigits: 2 );



I except the formatted output of 25000 to be 25.000,00 on keyup. But the actual output is 2,00.










share|improve this question






























    0















    I'm trying figure out a way to format in live an amount of an input box with local's 'it-IT' and minimumFractionDigits of > 2.



    This is my code https://jsfiddle.net/oLgtwjfr/



    $(document).on('keyup', '#inputKeyupExample', function(event) 

    var $this = $( this )
    var elementThis = this
    var input = $this.val()

    $this.val(formatNumber(parseInt(input)))
    )
    function formatNumber(x)
    return x.toLocaleString("it-IT",
    minimumFractionDigits: 2 );



    I except the formatted output of 25000 to be 25.000,00 on keyup. But the actual output is 2,00.










    share|improve this question


























      0












      0








      0








      I'm trying figure out a way to format in live an amount of an input box with local's 'it-IT' and minimumFractionDigits of > 2.



      This is my code https://jsfiddle.net/oLgtwjfr/



      $(document).on('keyup', '#inputKeyupExample', function(event) 

      var $this = $( this )
      var elementThis = this
      var input = $this.val()

      $this.val(formatNumber(parseInt(input)))
      )
      function formatNumber(x)
      return x.toLocaleString("it-IT",
      minimumFractionDigits: 2 );



      I except the formatted output of 25000 to be 25.000,00 on keyup. But the actual output is 2,00.










      share|improve this question














      I'm trying figure out a way to format in live an amount of an input box with local's 'it-IT' and minimumFractionDigits of > 2.



      This is my code https://jsfiddle.net/oLgtwjfr/



      $(document).on('keyup', '#inputKeyupExample', function(event) 

      var $this = $( this )
      var elementThis = this
      var input = $this.val()

      $this.val(formatNumber(parseInt(input)))
      )
      function formatNumber(x)
      return x.toLocaleString("it-IT",
      minimumFractionDigits: 2 );



      I except the formatted output of 25000 to be 25.000,00 on keyup. But the actual output is 2,00.







      javascript jquery html formatting






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 27 at 8:36









      fran openeyfran openey

      12 bronze badges




      12 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          0














          I'm not sure the input box supports that kind of functionality without a lot of extra programming. Also, it would become messy for the user to edit or change the value with lots of numeric formatting in place in that text box.
          Instead, consider a formatting display separate to the input like the following:



          https://jsfiddle.net/declanmcd/nuy9q5g4/4/



          So instead of



          $this.val(formatNumber(parseInt(input)));


          use



          $("#output").text(formatNumber(parseInt(input)));





          share|improve this answer
























            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372827%2fhow-to-format-amount-on-keyup-with-tolocalestring-using-minimumfractiondigits%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            I'm not sure the input box supports that kind of functionality without a lot of extra programming. Also, it would become messy for the user to edit or change the value with lots of numeric formatting in place in that text box.
            Instead, consider a formatting display separate to the input like the following:



            https://jsfiddle.net/declanmcd/nuy9q5g4/4/



            So instead of



            $this.val(formatNumber(parseInt(input)));


            use



            $("#output").text(formatNumber(parseInt(input)));





            share|improve this answer





























              0














              I'm not sure the input box supports that kind of functionality without a lot of extra programming. Also, it would become messy for the user to edit or change the value with lots of numeric formatting in place in that text box.
              Instead, consider a formatting display separate to the input like the following:



              https://jsfiddle.net/declanmcd/nuy9q5g4/4/



              So instead of



              $this.val(formatNumber(parseInt(input)));


              use



              $("#output").text(formatNumber(parseInt(input)));





              share|improve this answer



























                0












                0








                0







                I'm not sure the input box supports that kind of functionality without a lot of extra programming. Also, it would become messy for the user to edit or change the value with lots of numeric formatting in place in that text box.
                Instead, consider a formatting display separate to the input like the following:



                https://jsfiddle.net/declanmcd/nuy9q5g4/4/



                So instead of



                $this.val(formatNumber(parseInt(input)));


                use



                $("#output").text(formatNumber(parseInt(input)));





                share|improve this answer













                I'm not sure the input box supports that kind of functionality without a lot of extra programming. Also, it would become messy for the user to edit or change the value with lots of numeric formatting in place in that text box.
                Instead, consider a formatting display separate to the input like the following:



                https://jsfiddle.net/declanmcd/nuy9q5g4/4/



                So instead of



                $this.val(formatNumber(parseInt(input)));


                use



                $("#output").text(formatNumber(parseInt(input)));






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 9:56









                DeclanMcDDeclanMcD

                1,0732 gold badges17 silver badges29 bronze badges




                1,0732 gold badges17 silver badges29 bronze badges



















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55372827%2fhow-to-format-amount-on-keyup-with-tolocalestring-using-minimumfractiondigits%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

                    밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

                    1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴