HTML5的输入表单属性中有多个表单ID [英] Multiple form ID's in HTML5's input form attribute

查看:218
本文介绍了HTML5的输入表单属性中有多个表单ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML5 input元素包含一个'form'属性,它可以包含一个或多个空格分隔的id。请参阅下面的简化示例,其中form1和form2共享一个输入元素。

The HTML5 input element includes a 'form' attribute, which can contain one or more space delimited form id's. See below for a simplified example, where both form1 and form2 share an input element.

<form id="form1" method="post">
    <input type="submit">
</form>

<form id="form2" method="post">
    <input type="submit">
</form>

<input type="text" form="form1 form2">

至少,这就是它的工作原理:

http://swatelier.info/at/forms/HTML5attrib.asp 结果,
http://www.w3schools.com/tags/att_input_form.asp

At least, that's how it's supposed to work:
http://swatelier.info/at/forms/HTML5attrib.asp
http://www.w3schools.com/tags/att_input_form.asp

在Chrome 28中,我发现添加第二个表单ID会隐藏两种表单中的输入元素。什么样的现代浏览器(如果有的话)支持这个功能?

In Chrome 28, I see that adding a second form id hides an input element from both forms. What modern browsers, if any, support this functionality?

推荐答案

c> form 属性是文档中表单元素ID的空格分隔列表:

Nowhere in the spec says that the value of the form attribute is a space-separated list of IDs of form elements in the document:


如果重新关联的表单关联元素具有指定的表单属性,那么该属性的值必须是元素的所有者Document中的 a 表单元素的ID。

来源: WHATWG HTML5规范

这篇关于HTML5的输入表单属性中有多个表单ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆