Link to home
Start Free TrialLog in
Avatar of arendt73
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.  
Avatar of HonorGod
HonorGod
Flag of United States of America image

Use toFixed( 2 )

value.toFixed( 2 )

makes sure that there are 2 places after the decimal point
Avatar of arendt73
arendt73

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>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the grade & points.

Good luck & have a great day.