HTML5 - input=number and incompatible browsers

后端 未结 3 2003
耶瑟儿~
耶瑟儿~ 2020-12-30 01:04

I want to use the html5 element on my website, but i want to know what happens to this field in browsers that do not support this

相关标签:
3条回答
  • 2020-12-30 01:26

    Refer to

    • W3 - Input Types
    • W3 - Input Type Number
    • W3Schools - HTML 5 Input Types

    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.

    0 讨论(0)
  • 2020-12-30 01:26

    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"?

    0 讨论(0)
  • 2020-12-30 01:31

    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.

    0 讨论(0)
提交回复
热议问题