dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: javascript help needed

Hybrid View

  1. #1
    Join Date
    Nov 2004
    Location
    xxxyyy
    Posts
    357

    javascript help needed

    I want to put comma in currency value.

    Example: Here is the input and expected output

    input
    1234
    output
    1,234


    input
    1234567
    output
    1,234,567


    input
    123373.3333
    output
    123,373.33


    I'm using

    valuestring=valuestring.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");

    but this code does not format 123373.3333=>123,373.33

    How do I fix it ?

  2. #2
    Join Date
    Nov 2012
    Posts
    8
    var str=1234
    str.replace(`12`,1,2)

    mjwebsoltuions:http://www.themjwebsolutions.com/

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles