Format & parse a number with .numberformat()


Description: Format and parse a number, formatting it the way you want.


    <!doctype html>
    <html lang="en">
      <meta charset="utf-8">
      <title>numberformat demo</title>
      <script src=""></script>
    <p class="formatted"></p>


  • Usage

    • How to use:

      There are 2 ways of using this method, you may also specify custom options (View Example Usage below).

    • Element Value:

      Specify an element value which you want to format: (This takes the value of the element and formats it).

      Specified Value:

      Specify a value that you want to format: (This takes the value specified and formats it).

    • Example Usage:
      bitsyCode.numberformat(bitsyCode(".myElement").val()); // Formats number from input element with class .myElement
      bitsyCode.numberformat("1500"); // Formats to 1,500.00, uses default options.
      bitsyCode.numberformat("1500", { decimals: 2, decimals_point:".", thousands_sep:" " }); // Formats to 1 500.00, uses options specified.
  • Options

    • What options are there:
      decimals: 2 (default value) /* Specify amount of decimals. */
      decimals_point: "." (default value) /* Specify the decimals separator. */
      thousands_sep: "," (default value) /* Specify the thousands separator. */
  • Returns

    • Returns:

      Formatted Value.