Follow Me

How to convert number to word in javascript

Mon, Aug 2, 2010

JavaScript, PHP

Today I am sharing number to text convert script that simply input number and produce its wordy counterparts. It is the most simple script and easy to implement in the project.

Example : Suppose you want to make ‘ 12345 ‘ read like ‘ twelve thousand
three hundred forty five
‘ , Enter your number in text box (see demo) and Javascript will write it out in words for you as you type. Only numeric characters are considered in the calculation. All other characters, and that includes the dot and the comma, are ignored.

Functionality – You just need to call update function of javascript on the blur event of text box and onsubmit of form.

Return text will be display under a div having id ‘word’.

You can see demo and download source code.

Number to word conversion demo
Download script for number to word conversion
Here is the updated code to display cents after numbers.

Download script for number to word conversion

Hope this script will help you to quick develop your applications.
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
  • blogmarks
  • Design Float
  • DZone
  • MySpace
  • Reddit
  • StumbleUpon
  • Twitter
, , , ,

Related Posts:


Recent Posts:

  • Best collection of firefox addons for web designers and developers
  • .htaccess basic features with example
  • how to include an external css and js with javascript dynamically
  • How to preserve line breaks in textarea mysql data
  • how to generate excel report with php and mysql
  • 7 Comments For This Post

    1. ZeeShan Says:

      Nice script, its useful. Good work

    2. admin Says:

      Thanks ZeeShan

    3. Gloson Says:

      Wow! Great script, Amit! Works like a charm! :)

    4. admin Says:

      Thanks Gloson.. Keep Visiting

    5. sanjaya Says:

      mm..
      cents is not functioning …

      Eg: 114500.50
      …?

    6. admin Says:

      @sanjaya I have modified script to display cents after numbers. (Download it from below original script download button in above post)

    7. Nick Olsen Says:

      Thanks! Had to modify it a bit but the majority of the work was all done!

    Leave a Reply