Bootstrap 4,thead和tr不对齐

问题描述 投票:0回答:2

我有这个页面与jquery,bootstrap 4表

这是网址http://vault.shopshop.space/

当我点击下拉列表选择不同的日期时,我的jquery将删除tbody并附加一些新的数据行,例如<tr><td>...</td></tr>

初始加载(全屏好)

enter image description here

选择过滤器后(不好,没有对齐)

enter image description here

jquery bootstrap-4
2个回答
0
投票

在<thead>中追加<tbody>元素。您应该清空<tbody>,然后在<tbody>中追加表行。

<table>
   <thead>
       <tr>
        <th>col 1</th>
        <th>col 2</th>
        <th>col 3</th>
       </tr>
   </thead>
   <tbody>
       <!-- Empty -->
   </tbody>
</table>

然后追加<tbody>:

$("tbody").append("<tr>
           <td>col 1<td><td>col 2<td><td>col 3<td>
           </tr>")

1
投票

仔细观察:tbodythead下:

enter image description here

结果如下:

enter image description here

你应该附加到表或使用insertAfterhttp://api.jquery.com/insertafter/

© www.soinside.com 2019 - 2024. All rights reserved.