<input>
是否有效没有它在 <form>
?
有一个标记页面中的某些字段的过程,并且刚刚发现一个页面的输入字段没有按我的预期进行标记。
我花了一段时间,但发现获取表单元素然后获取字段的过程是导致这些被遗漏的原因,因为没有表单。
最佳答案
<input>
没有 <form>
appears valid ,是的(至少对于 html 4.01,请看接近 17.2.1 的末尾):
The elements used to create controls generally appear inside a FORM element, but may also appear outside of a FORM element declaration when they are used to build user interfaces. This is discussed in the section on intrinsic events. Note that controls outside a form cannot be successful controls.
关于html - 没有 <form> 的 <input> 格式是否正确?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3294572/