This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes how to format number as money in javascript? e.g 1000 to 1,000 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to format number as money in javascript? e.g 1000 to 1,000" Watch "how to format number as money in javascript? e.g 1000 to 1,000" New topic
Author

how to format number as money in javascript? e.g 1000 to 1,000

chrstian ferma
Ranch Hand

Joined: Mar 26, 2014
Posts: 56

how to format number as money in javascript? e.g 1000 to 1,000
eg. 100000000 then it will be format into 1,000,000,000 can you give me some ideas thank you
Luan Cestari
Ranch Hand

Joined: Feb 07, 2010
Posts: 162

I would use http://numeraljs.com/


Please, visit me for some cool tech post at www.ourdailycodes.com
Devaka Cooray
ExamLab Creator
Saloon Keeper

Joined: Jul 29, 2008
Posts: 3011
    
  34

Use JSTL functions as in <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>, and use its formatNumber tag:

<fmt:formatNumber type="number" value="${your_number_here}" />


Founder of ExamLab and Systemup
See how I can help you to become an awesome programmer
chrstian ferma
Ranch Hand

Joined: Mar 26, 2014
Posts: 56

thaks man , i also use the but i use that when i getting the values from database for editing this is what i did i just want to share

need a function document.ready so that every time the page loads the function is working then pass the id to of textbox in that function $('#textboxid').mask(the masking format here e.g 99/99/9999)

then in controller convert the value from string to double before inserting into database then it works, just need the jqeury maskingplug in on eclipse then it works thanks correct me if im mistaken. :)
 
 
subject: how to format number as money in javascript? e.g 1000 to 1,000
 
Similar Threads
Generate Excel Report with , seperated Numeric Data
Pig and number format
format attribute in bean:write not working
memory
Convert exponential to number