数字和不兼容的浏览器

数字和不兼容的浏览器

本文介绍了HTML5 - 输入=数字和不兼容的浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上使用html5元素 HTML规范中的code>属性。


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?

解决方案

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.

这篇关于HTML5 - 输入=数字和不兼容的浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 15:48