Input number accept point in firefox

0

Can you help me?

I have this input number that must accept values in decimal. People fill in the decimal point (.) And not with a comma (,)

In all browsers it works just fine, EXCEPT in firefox which is our default browser. (Firefox is only allowing (,) and not (.))

I looked in several sites (including here in stackoverflow) and several methods, the only way it worked was to leave the input as text and apply a mask with js converting (.) into (,) thus avoiding doubt or error noob of the user.

How can I allow firefox to accept (.) the input number? Anybody know? Thanks!

    
asked by anonymous 30.01.2018 / 15:19

2 answers

0

Alright !! I got a much simpler solution using:

< html lang="en" >

In this way the browser interprets the site with the language I want, so the point (.) begins to be accepted !!! Great Hugs !!!

    
05.02.2018 / 17:00
1

Note: Any number is an acceptable value as long as it is a valid floating point number (ie not NaN or Infinity).

"1.0" is different "1.0" has to see how your browser handles floating point;

Decimal separator have countries that represent with ",", eg: R $; and countries they represent with "." ex: $;

To accept "1.0" only depends on the location of your browser it will transform to "1.0".

<input type="number" placeholder="1.0" step="0.01" min="0" max="10">

<html>
<body>
  <input type="number" placeholder="1.0" step="0.01" min="0" max="10">
</body>
</html>

link

  

Curiosity: Even if you try to force using toLocaleString ()    input "number" follows the browser locale characteristic;

var number = 3.5;
document.getElementsByTagName("input")[0].value = number.toFixed(2).toLocaleString('en-US');
console.log(number.toLocaleString());
<html>
<body>
   <input type="number">
</body>
</html>
    
30.01.2018 / 15:49