Difference between revisions of "SsFormatCurrency"

From SmartWiki
Jump to: navigation, search
(Overview)
(Requirements)
Line 26: Line 26:
 
[[Category:validate.js]]
 
[[Category:validate.js]]
 
[[Category:Currency]]
 
[[Category:Currency]]
 +
[[Category:Validation]]

Revision as of 15:07, 24 June 2013

Overview

To format a number as a currency using JavaScript you can use a function called ssFormatCurrency.

Syntax

ssFormatCurrency( number, symbol );

Where:
number - is a number to be converted to a currency (i.e: 5000)
symbol - is a currency symbol you want to use, i.e. "€", "$", "£", ...


Example

ssFormatCurrency(5000, "€");

Will return: €5,000.00


Requirements

This function is part of validate.js library and needs to be added to Browser Script custom fields or on template pages, sign-up pages etc. using the following syntax:

<SCRIPT type="text/javascript" language="javascript" src="/validate.js"></SCRIPT>