Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firefox always show any numeric input as NAN

Tags:

firefox

nan

I installed a new fresh windows 8.1 (64bit) and then install Firefox 33.1.1 without any add-on or extensions after that. but Firefox show every numeric input (type="number") as NAN even without any JavaScript code. (other browser haven't any problem with that.) for example code below show as this:

<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</head>
<body>
<form method="post" action="">
    <input type="number" />
</form>
</body>
</html>

enter image description here

like image 862
DarkMaze Avatar asked Dec 01 '14 13:12

DarkMaze


People also ask

How do you prevent a zero as the first character when typing in input type number?

charCodeAt(0) && $(this). val(). trim() == "") { return false; } });

How do I make text fields only accept numbers?

You can use the <input> tag with attribute type='number'. This input field allows only numerical values. You can also specify the minimum value and maximum value that should be accepted by this field.


1 Answers

this is a bug in Firefox!

i think this problem exists for the Persian language (or maybe arabic)

To fix this problem in windows, set Decimal Symbol to Dot "."

Note: Region > Additional Setting

But in my opinion, now is the best solution use type="text" instead of type"number" for inputs

like image 182
Amir Sa Avatar answered Oct 27 '22 11:10

Amir Sa