Sheldon Livingston
asked on
How to replace comma with JavaScript
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why should that work when your control as a number format active?
var rent = document.getElementById("txtRent").value;
rent = rent.replace(/,/g,''); // set it again !
alert(rent);
or :
var rent = document.getElementById("txtRent").value;
alert(rent.replace(/,/g,''));
It seems like your input is defined as number, and I presume there's a good reason for that, so what I would do is make input hidden, take it's value, turn it to text, and then get rid of the comma if it's still there, feed the value to another input that is defined as text.