title: How to handle floats and decimal separators with html5 input type number
body: <p>Im building web app which is mainly for mobile browsers. Im using input fields with number type, so (most) mobile browsers invokes only number keyboard for better user experience. This web app is mainly used in regions where decimal separator is comma, not dot, so I need to handle both decimal separators.</p>
  
  <p>How to cover this whole mess with dot and comma?</p>
  
  <p>My findings:</p>
  
  <p><strong>Desktop Chrome</strong></p>
  
  <ul>
  <li>Input type=number</li>
  <li>User enters "4,55" to input field </li>
  <li><code>$("#my_input").val();</code> returns "455"</li>
  <li>I can not get the correct value from input</li>
  </ul>
  
  <p><strong>Desktop Firefox</strong></p>
  
  <ul>
  <li>Input type=number</li>
  <li>User enters "4,55" to input field </li>
  <li><code>$("#my_input").val();</code> returns "4,55"</li>
  <li>Thats fine, I can replace comma with dot and get correct float</li>
  </ul>
  
  <p><strong>Android browser</strong></p>
  
  <ul>
  <li>Input type=number</li>
  <li>User enters "4,55" to input field </li>
  <li>When input loses focus, value is truncated to "4"</li>
  <li>Confusing to user</li>
  </ul>
  
  <p><strong>Windows Phone 8</strong></p>
  
  <ul>
  <li>Input type=number</li>
  <li>User enters "4,55" to input field </li>
  <li><code>$("#my_input").val();</code> returns "4,55"</li>
  <li>Thats fine, I can replace comma with dot and get correct float</li>
  </ul>
  
  <p>What are the "best practices" in this kind of situations when user might use comma or dot as decimal separator and I want to keep html input type as number, to provide better user experience?</p>
  
  <p>Can I convert comma to dot "on the fly", binding key events, is it working with number inputs?</p>
  
  <h2>EDIT</h2>
  
  <p>Currenlty I do not have any solution, how to get float value (as string or number) from input which type is set to number. If enduser enters "4,55", Chrome returns always "455", Firefox returns "4,55" which is fine.</p>
  
  <p>Also it is quite annoying that in Android (tested 4.2 emulator), when I enter "4,55" to input field and change focus to somewhere else, the entered number get truncated to "4".</p>