table元素在哪里允许使用form元素? [英] Where are the form elements allowed within a table element?
问题描述
我想像这样在列标题上方创建一个带有搜索文本框的表
I want to create a table with search textbox above the column headings as such
<table>
<thead>
<tr><td><input type="text" /></td><td><input type="text" /></td></tr>
<tr><td>Mother</td><td>Father</td></tr>
</thead>
<tbody id="search-results">
<!-- to be populated by AJAX response -->
</tbody>
</table>
是否允许这样的表单元素?
Is the form element allowed like this?
<form>
<thead>...</thead>
</form>
或
<thead>
<form>...</form>
</thead>
或哪种方式?
还可以将< input type ="hidden"/>
绝对放置在表单标签之间的任何位置吗?
Also, can <input type="hidden" />
be place absolutely anywhere between the form tags?
推荐答案
您应将整个< table>
元素包装在< form>
中,您不能将在< table>
内部与表无关的任何东西,除了< th>
,< td>
和<caption>
元素.因此,如果您不想将整个表格放在< td>
单元格中,则应将整个表格包装在< form>
中.
You should wrap the entire <table>
element in <form>
, you cannot put anything which is not table related inside <table>
except for inside <th>
, <td>
and <caption>
elements. So if you do not want to put the entire form in a <td>
cell, you should wrap the entire table in <form>
.
<输入类型="hidden">
标签与其他任何输入标签一样-必须包装在< td>
和其他内容标签中.
<input type="hidden">
tags are just like any other input tags - they must be wrapped inside <td>
and other content tags.
这篇关于table元素在哪里允许使用form元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!