Context: I have a text field in my form that is meant for entering an amount of money. I want variables for dollars and cents. Can javascript find the location of the decimal point, and separate it into two integers?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
"$111.01".split('.');yields['$111', '01']Then it’s a matter of cleaning that up (
.replace) and coercing them into ints (parseInt).