title: jQuery - Setting number input value as float in Firefox
body: <p>I have a function bound to the blur event for a specific class (attached to number type inputs) that is intended to force two decimal places. The following function works in Chrome, but does not work in Firefox.</p>
  
  <p>Code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>/**
   * Force 2 decimal places for specified inputs
   *
   */
  $(document).on('blur', '.to-dec', function() {
  
    // get value
    var value = $(this).val();
  
    // no value
    if (!value) return;
  
    // cast to 2 decimal places
    value = parseFloat(value).toFixed(2);
  
    // update value
    $(this).val(value);
  
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type="number" class="to-dec" min="0" step="0.01" required&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>If I output <code>value</code> before it is set, I get the expected value (ie. 3.00 for an input value of 3).</p>
  
  <p>Anyone know why Firefox would be preventing this value to be set? I've already tried to use <code>parseFloat()</code> when setting the value with <code>val()</code>.</p>
  
  <p>Thanks!</p>