arendt73
asked on
Javascript add decimal point automatically (.00) to a field after number is entered
I have a text field where users enter whole numbers. What I want to do is to automically add a decimal point and two zeros to the end of the number (ex: 123.00) when it is manually entered. For some reason, it is too much work for users to simply add .00 manually.
Anyway, any assistance is greatly appreciated. Thank you.
Anyway, any assistance is greatly appreciated. Thank you.
ASKER
Thank you. Where will this be placed in my code?
<tr>
<td><strong>Amount Entered:</strong></td>
<td> <input name="amount" type="text" id="amount" size="6" maxlength="8">
<span class="text-small"></span></td>
</tr>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the grade & points.
Good luck & have a great day.
Good luck & have a great day.
value.toFixed( 2 )
makes sure that there are 2 places after the decimal point