Timeline for Why does the HTML input with type "number" allow the letter 'e' to be entered in the field?
Current License: CC BY-SA 4.0
14 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Apr 12, 2019 at 20:55 | history | edited | j08691 | CC BY-SA 4.0 |
added 47 characters in body
|
Apr 5, 2018 at 16:58 | comment | added | Scott Marcus |
@Anthony No, e stands for Exponent.
|
|
Nov 6, 2017 at 15:26 | history | edited | j08691 | CC BY-SA 3.0 |
added 15 characters in body
|
Sep 25, 2017 at 6:31 | comment | added | oldboy |
I just discovered this. I'm assuming the 'e' character is possibly used to indicate 'extension' for phone numbers since type=tel isn't commonly adopted
|
|
Jan 13, 2017 at 11:18 | comment | added | Ped7g | @Simon "as soon as I write e", well, yes "4e" is not a number, while for example "4e+0" is a valid number (4). If you have some "live" client-side javascript code working with partial user input, you have to give user time to finish his input editing to provide full value, and not interfere half way into editing. If you have "undefined" from "4e+0" input, fix your "to number" parser. The example from question works well, reports "4e+1" as error, and "4e+0" is returned correctly as "4e+0" (ie. number between 1 and 5). | |
Jan 13, 2017 at 11:08 | comment | added | Seimen |
@Ped7g Well that's exactly the problem! If I want to read out the value to find out it's 200 either way I can't, because input.value will return undefined as soon as I write the "e".
|
|
Jan 12, 2017 at 18:37 | comment | added | Ped7g | @Simon depends whether the value is string or numeric value. If it's numeric, 2e2 is 200, those are equal values and it doesn't matter which form of presentation you use to display it, it's still 0b11001000 either way. If the input is string, then well, convert it to number first, so you don't have to bother which format was used to input the value. | |
Aug 19, 2016 at 7:09 | history | edited | Nisse Engström | CC BY-SA 3.0 |
Added space to align list item correctly. Formatted characters as inline code according to the original source.
|
Jul 22, 2016 at 12:42 | comment | added | Seimen |
Shouldn't the input.value then return 200 if you type in 2e2 ?
|
|
Jul 21, 2016 at 16:38 | comment | added | Gnarlywhale |
@Simon, using the e is useful for condensing large numbers that would be otherwise tedious to type out. As a trivial example, 2e2 = 2*10^2 = 200
|
|
Apr 26, 2016 at 9:35 | comment | added | ZeroBased_IX | @Simon It's the exponent, you can see it in action if you multiply a large number by a large number and the calculator doesn't have enough supported digits to display it. Someone who is better at mathematics might explain it better. | |
Apr 19, 2016 at 15:31 | comment | added | Seimen | I'm still baffled by this, first of all I'm not a mathematician, so what does "e" stand for in the context of a number? Second I don't get why input.value is an empty string as soon as you write an "e" in it, even though there are numbers and the character is allowed... | |
Jul 29, 2015 at 17:11 | vote | accept | Gnarlywhale | ||
Jul 29, 2015 at 17:03 | history | answered | j08691 | CC BY-SA 3.0 |