I have this jQuery code:
$('#amount').change(function() {
$('#amount').val( $('#amount').val().toFixed(2) );
}); // end .change()
I need it to format the input in decmial format. Can it be done in jquery?
Example: In a text box,
if I enter 5
I want the value to be shown as 5.00
if I enter 5.1
I want the value to be shown as 5.10
if I enter 5.12
I want the value to be shown as 5.12
seems to be a simple need. I have to be missing something because I cannot imagine that javascript or jquery does not provide a function to do this.