inputmode属性是否有效(在HTML5表单中)?

bre*_*ung 14 forms validation html5

我在文本区域和文本字段上使用inputmode属性获得验证错误.验证器告诉我此时元素输入上不允许属性inputmode,HTML5规范表明它是允许的.

这个代码实际上有问题,还是验证器有问题?

这是一个简单的案例,它将产生这种验证错误(两次),在一种情况下在电子邮件输入上,另一种情况在textarea上.

<!DOCTYPE HTML>
<html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <form method="post" action="contactme.php">         
      <label class='pas block'>
        Your E-Mail:<br/>
        <input type='email' name='email' required inputmode='latin' placeholder='your e-mail here' />
      </label>
        <label class='pas block'>
                Your Message:<br/>
                <textarea name='message' required inputmode='latin' placeholder='and your message here!'></textarea>
        </label>
    </form>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

Alb*_*sch 9

此外,请参阅此处有关哪些属性适用于不同输入类型的图表:http: //www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#attr-input-类型

"inputmode"属性仅适用于"text"和"search".

另一方面,"inputmode"不是W3C HTML5属性,但它是W3C HTML 5.1属性(至少在我写这篇文章的时候).

访问http://www.OnlineWebCheck.com/以获取更好的错误/警告消息.


dsa*_*sas 1

HTML5 规范说

以下内容属性不得指定且不适用于元素:accept、alt、checked、dirname、formaction、formenctype、formmethod、formnovalidate、formtarget、height、inputmode、max、min、src、step 和 width。

它位于https://html.spec.whatwg.org/multipage/input.html#e-mail-state-(type=email)的簿记详细信息下

  • 此簿记详细信息专门针对“[type=email]”元素以及文本和搜索状态([spec](http://www.whatwg.org/specs/web-apps/current-work/multipage/states- of-the-type-attribute.html#text-(type=text)-state-and-search-state-(type=search))) 它说*以下常见输入元素内容属性、IDL 属性和方法适用到元素:.....* ***输入模式*** (9认同)