[Javascript] Number formatting

Liam Rice Liam.Rice at autodata.net
Thu Jun 29 14:26:51 CDT 2006


Hi there everybody, I'm having a few issues with number formatting from
an input field.  

I've got a set of user input fields where a user is able to enter a
number.  The user can enter with or without commas/spaces for
separators.  I'm trying to remove them, but I keep getting the error
iNum.replace is not a function.  Anybody have any ideas?  

function cleanNumber(iNum) {
	iNum = iNum.replace(",","");
	iNum = iNum.replace(' ','');
	iNum = parseFloat(iNum);
	
	return iNum;
}



More information about the Javascript mailing list