title: How to format a text input as a decimal in jquery
body: <p>I have this jQuery code:</p>
  
  <pre><code>$('#amount').change(function() {
    $('#amount').val( $('#amount').val().toFixed(2) );
  }); // end .change()
  </code></pre>
  
  <p>I need it to format the input in decmial format. Can it be done in jquery?</p>
  
  <p>Example:
  In a text box,</p>
  
  <p>if I enter <code>5</code> I want the value to be shown as <code>5.00</code></p>
  
  <p>if I enter <code>5.1</code> I want the value to be shown as <code>5.10</code></p>
  
  <p>if I enter <code>5.12</code> I want the value to be shown as <code>5.12</code></p>
  
  <p>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.</p>