Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用Jquery在一个列标题下包含两列_Javascript_Html - Fatal编程技术网

Javascript 如何使用Jquery在一个列标题下包含两列

Javascript 如何使用Jquery在一个列标题下包含两列,javascript,html,Javascript,Html,这是我的html表,我正在尝试如何使用Jquery在一个列标题下包含2列我尝试了以下代码: $('#test th.column_Column1').append( $('<th/>', {text : 'HEADER BOth'}) ); $('#test th.column_Column1')。追加($(''',{text:'HEADER-tware'})); 但它不能提供所需的输出: <table class="xrounded_shadowed default fo

这是我的html表,我正在尝试如何使用Jquery在一个列标题下包含2列我尝试了以下代码:

$('#test th.column_Column1').append( $('<th/>', {text : 'HEADER BOth'}) );
$('#test th.column_Column1')。追加($(''',{text:'HEADER-tware'}));
但它不能提供所需的输出:

<table class="xrounded_shadowed default footable-loaded footable" id="test">
<thead>
<tr>
<th class="select_checkbox footable-visible footable-first-column" style="width: 40px;"><label><input type="checkbox" onclick="toggleAll(this)" style="float:left;"><i></i></label></th>
<th class="column_Column1 footable-visible">Column1</th>
<th class="column_Column2 footable-visible footable-last-column">Hari</th></tr></thead>
<tbody>
<tr class="odd">
<td class="select_checkbox footable-visible footable-first-column"><label><input type="checkbox" name="d-49700-checkbox_username" value=""><i></i></label></td>
<td class="column_Column1 footable-visible" style=""><span class="footable-toggle"></span>01/01/2019</td>
<td class="column_Column2 footable-visible footable-last-column" style="">Tuesday</td></tr>
<tr class="even">
<td class="select_checkbox footable-visible footable-first-column"><label><input type="checkbox" name="d-49700-checkbox_username" value=""><i></i></label></td>
<td class="column_Column1 footable-visible" style=""><span class="footable-toggle"></span>01/01/2019</td>
<td class="column_Column2 footable-visible footable-last-column" style="">Tuesday</td></tr>
<tr class="odd">
<td class="select_checkbox footable-visible footable-first-column"><label><input type="checkbox" name="d-49700-checkbox_username" value=""><i></i></label></td>
<td class="column_Column1 footable-visible" style=""><span class="footable-toggle"></span>01/01/2019</td>
<td class="column_Column2 footable-visible footable-last-column" style="">Tuesday</td></tr>
<tr class="even">
<td class="select_checkbox footable-visible footable-first-column"><label><input type="checkbox" name="d-49700-checkbox_username" value=""><i></i></label></td>
<td class="column_Column1 footable-visible" style=""><span class="footable-toggle"></span>01/01/2019</td>
<td class="column_Column2 footable-visible footable-last-column" style="">Tuesday</td></tr>
<tr class="odd">
<td class="select_checkbox footable-visible footable-first-column"><label><input type="checkbox" name="d-49700-checkbox_username" value=""><i></i></label></td>
<td class="column_Column1 footable-visible" style=""><span class="footable-toggle"></span>01/01/2019</td>
<td class="column_Column2 footable-visible footable-last-column" style="">Tuesday</td></tr></tbody></table>


专栏1
哈里
01/01/2019
星期二
01/01/2019
星期二
01/01/2019
星期二
01/01/2019
星期二
01/01/2019
星期二

添加两行,第一行应该有一个跨所有列的列

<table>
    <thead>
          <tr>
              <th colSpan="2">Column Header</th>
          </tr>
          <tr>
              <th>Column 1</th>
              <th>Column 2</th>
          </tr>
    </thead>
</table>

使用
colSpan
rowsspan
属性来执行此类操作。在这种情况下,使用需要使用
colSpan
到ur
。然后设置它的
文本对齐:居中
,就可以完成了

th:n子项(1){
文本对齐:居中;
}
th,td{
边框:2倍实心
}
桌子{
边界塌陷:塌陷;
}

行标题
第1栏
第2栏
第1栏项目
第2栏项目
第1栏项目
第2栏项目

对不起,我想您应该添加两行,而不是两列,对吗?