Javascript 将html表的行转换为引导卡
我有一个html表格,其中的行如下:Javascript 将html表的行转换为引导卡,javascript,html,jquery,twitter-bootstrap,Javascript,Html,Jquery,Twitter Bootstrap,我有一个html表格,其中的行如下: <table id="tb" class="table table-bordered table-hover table-condensed"> <thead> <tr> <th>title</th> <th>price</th> <th>
<table id="tb" class="table table-bordered table-hover table-condensed">
<thead>
<tr>
<th>title</th>
<th>price</th>
<th>discount</th>
<th>image</th>
</tr>
</thead>
<tbody>
<tr>
<td>PRODUCT 1</td>
<td align="right">24.43</td>
<td align="right">53</td>
<td>https://images-na.ssl-images-amazon.com/images/I/81xV%2BD1OkGL._AC_SL1500_.jpg</td>
</tr>
<tr>
<td>PRODUCT 2</td>
<td align="right">50.27</td>
<td align="right">70</td>
<td>https://images-na.ssl-images-amazon.com/images/I/61d-BO4sARL._AC_SL1500_.jpg</td>
</tr>
<!-- ... many other rows -->
<!-- I added this script to put the image link inside src -->
<script>
$('#tb td:nth-child(4n)').each((i, el) => {
$(el).wrapInner(`<img src="${el.innerText}" class="img-fluid"/>`);
});
</script>
它不起作用,返回每一行的顶部
我想要这样的结果:
获取HTML代码并使用javascript将其转换为其他复杂格式非常困难。如果你想手工做任何事情,你可以用HTML手工制作卡片。但是,我建议使用数据库和PHP以编程方式使用数据库中的数据创建这些卡片或表格 以下是有关如何创建这些引导卡的一些信息:
下面是一些关于如何使用数据库和PHP自动创建这些卡片的信息:获取HTML代码并使用javascript将其转换为其他复杂格式非常困难。如果你想手工做任何事情,你可以用HTML手工制作卡片。但是,我建议使用数据库和PHP以编程方式使用数据库中的数据创建这些卡片或表格 以下是有关如何创建这些引导卡的一些信息:
以下是有关如何使用数据库和PHP自动创建这些卡片的一些信息:您可以添加所需输出吗?我添加了所需输出这感觉像是一个。您可以解释为什么无法修改正在渲染的模板吗?您可以添加所需输出吗?我添加了所需输出这感觉像一个。您可以解释为什么吗无法修改正在渲染的模板?
$('#tb tr').addClass("card")