Torben
Torben

Reputation: 5494

HTML5 - input=number and incompatible browsers

I want to use the html5 element <input type="number"> on my website, but i want to know what happens to this field in browsers that do not support this feature? Is it than a classic <input type="text"> field for those browsers?

Upvotes: 23

Views: 13210

Answers (3)

Siva Charan
Siva Charan

Reputation: 18064

Refer to

Open this Example on IE and Chrome and see the difference.

Supported Browsers:

  • Opera
  • Safari
  • Chrome

If HTML 5 Input Types are not supported on a browser, they will behave as regular text fields.

Upvotes: 5

maxweber
maxweber

Reputation: 576

Caution, while older browsers ignore and default to "text", many newer browsers simply do the wrong thing. See: What models of Samsung smartphones have missing period for html5 input type="number"?

Upvotes: 2

0b10011
0b10011

Reputation: 18795

When a browser does not recognize a particular type value for an <input>, it reverts to it's default value, which is text. So, all of the following are equivalent on browsers that do not support type="number":

<input type="number">
<input type="somevaluethatdoesntexist">
<input type="text">
<input>

For browsers that do support type="number", the number <input> will be displayed instead of the text <input>.

Read more about the type attribute in the HTML Specification.

Upvotes: 29

Related Questions