javascript - 如何将 botton 放在表格旁边的行数据 html 引导程序
问题描述
我想在表格的每一行数据中的表格数据旁边制作一个按钮。我试图为它创建一个新列来放置按钮,但它有一个边框。我想要它没有边框,只是按钮。我为此使用引导程序 4
这是我的html
<div class="card-body col-10">
<div class="table-responsive">
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>Email</th>
<th>Password</th>
<th>Phone</th>
<th>Privilege</th>
</tr>
</thead>
<tfoot>
<tr>
<th>Name</th>
<th>Email</th>
<th>Password</th>
<th>Phone</th>
<th>Privilege</th>
</tfoot>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System@you.com</td>
<td>Edinburgh</td>
<td>081290188409</td>
<td>1</td>
</tr>
<tr>
<td>Tiger Nixon</td>
<td>System@you.com</td>
<td>Edinburgh</td>
<td>081290188409</td>
<td>1</td>
</tr>
<tr>
<td>Tiger Nixon</td>
<td>System@you.com</td>
<td>Edinburgh</td>
<td>081290188409</td>
<td>1</td>
</tr>
<tr>
<td>Tiger Nixon</td>
<td>System@you.com</td>
<td>Edinburgh</td>
<td>081290188409</td>
<td>1</td>
</tr>
</tbody>
</table>
</div>
</div>
我想让特权旁边的表格右侧的按钮不是表格。
我试图让它像这个代码中的表格
<div class="card-body col-1">
<div class="tablen float-left">
<table class="table table-borderless" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Delete</th>
</tr>
</thead>
<tbody>
<tr>
<td><button type="button" class="btn btn-danger fas fa-table float-left"></button></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
但它离它旁边的桌子太远了。我想要它就在桌子旁边。如果你知道请帮忙。谢谢你
解决方案
使用 JQuery,您可以使用它,
它也可以通过 CSS3 使用 :before 来解决,但我不知道它的确切语法。
所以这里是 JQuery 代码
$("td").each(function (){
$(this).append("<button type='button' class='btn btn-danger fas fa-table float-left'></button>" );
});
推荐阅读
- angular - 在多个 api 调用同时运行时中断一个 api 调用,并在 angular5 中为中断的 api 调用提供优先级
- ruby-on-rails - 如何从javascript将参数传递给控制器ruby方法
- c# - Blob 存储文件的最大读取次数/秒
- ios - iPhone 8 和 X 的模拟器错误:无法查找服务 com.apple.CoreSimulator.host_support: 0x3
- java - 单击跨度到多个字符串 android(更新代码)
- operators - 为什么 Perl 6 REPL 中不保留新的运算符定义?
- php - cURL 在 php 中不起作用
- database - PostgreSQL 用唯一整数替换列数据
- vba - 编译错误 vba - 我想覆盖它
- java - Java为什么我的双数最后得到数字