stackOverFlowGeek
stackOverFlowGeek

Reputation: 99

All characters is not typed except e character in input tag with number attribute

I am using this input in one of form.why is it let user to type e character?.I am testing an web-application.

 <input type="number" class="form-control" id="mobile" name="mobile" 
 placeholder="Enter Mobile" data-type="alphanum" />

Upvotes: 2

Views: 58

Answers (2)

manish kumar
manish kumar

Reputation: 4700

Because that's exactly how the spec says it should work. The number input can accept floating point numbers, including negative symbols and the e or E character:

A floating-point number consists of the following parts, in exactly the following order:

  1. Optionally, the first character may be a "-" character.
  2. One or more characters in the range "0—9".
  3. Optionally, the following parts, in exactly the following order:
    1. a "." character
    2. one or more characters in the range "0—9"
  4. Optionally, the following parts, in exactly the following order:
    1. a "e" character or "E" character
    2. optionally, a "-" character or "+" character
    3. One or more characters in the range "0—9".

--

Read This

Upvotes: 1

Elon Musk
Elon Musk

Reputation: 364

e is a valid mathematical number which equals to 2.718 to 3 decimal places.

Read more: Mathematical constant e

Upvotes: 3

Related Questions