Hi there,
I'm writing a jquery wrapper method which takes a figure eg 1234567.89 from a input box and replaces it with a formatted currency
string eg £1,234,567.89 and vica versa.
It SHOULD be working...lol. But isn't.
Basically the way the method works is that it takes whatever is in the input box and reduces it to just numbers a decimal point (.) and two more numbers after the decimal place. This is asigned to the 'result' variable.
Then if the 'direction' option has 'toCurrency', then the necessary commas and currency symbols are added.
The method works fine of the 'toCurrency' option is chosen, but not if it is left out. This is very strange because I have used alerts to check the value of the result variable before the 'if' and I have the correct value. If the 'toCurrency' option is not chosen, it should just miss the 'if' and use the result value which I have just checked on. But it doesn't. I have put an alert at the end of the if statement and it prints out the correct answer if the 'toCurrency' option is chosen, but prints nothing if it is not. Strange. I wonder if anyone can see my mistake? Here is my code:
Many thanks
Joe