英文:
Image and link are not rendering inside HTML table
问题
我有一个表格,其中包含图像和链接字段。但它显示的是代码而不是呈现内容。
以下是您提供的HTML代码的翻译:
<table id="table" data-toggle="table" data-search="true" data-filter-control="true" data-show-export="true" data-show-refresh="true" data-show-toggle="true" data-pagination="true" data-toolbar="#toolbar" class="table-responsive">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="prenom" data-filter-control="input" data-sortable="true">标题</th>
<th data-field="date" data-filter-control="select" data-sortable="true">价格</th>
<th data-field="examen" data-filter-control="select" data-sortable="true">图片</th>
<th data-field="note" data-sortable="true">链接</th>
</tr>
</thead>
<tbody>
<tr>
<td class="bs-checkbox"><input data-index="0" name="btSelectItem" type="checkbox"></td>
<td>数学辅导</td>
<td>$20</td>
<td><img src="https://i.imgur.com/0GoaYKd.jpg" height="100" width="100"></td>
<td><a href="https://monsoonmalabar.com/sonyshop/other/product-13/">前往</a></td>
</tr>
<tr>
<td class="bs-checkbox"><input data-index="1" name="btSelectItem" type="checkbox"></td>
<td>牛奶</td>
<td>$5</td>
<td><img src="https://i.imgur.com/2ZOroMI.jpg" height="100" width="100"></td>
<td><a href="https://monsoonmalabar.com/sonyshop/test_category_2/product-6/">前往</a></td>
</tr>
</tbody>
</table>
您提到的网站链接是https://www.monsoonmalabar.com/aggregate_search。要在这个网页上呈现HTML,请确保在网页上包含所提供的HTML代码,并确保网页支持JavaScript和Bootstrap框架,因为您的表格使用了Bootstrap的数据表格组件。这样,您的表格应该在该网页上正确呈现和工作。
英文:
I have a table with fields having images and links. But it gives code instead of rendering it.
<table id="table"
data-toggle="table"
data-search="true"
data-filter-control="true"
data-show-export="true"
data-show-refresh="true"
data-show-toggle="true"
data-pagination="true"
data-toolbar="#toolbar"
class="table-responsive">
<thead>
<tr>
<th data-field="state" data-checkbox="true"></th>
<th data-field="prenom" data-filter-control="input" data-sortable="true">Title</th>
<th data-field="date" data-filter-control="select" data-sortable="true">Price</th>
<th data-field="examen" data-filter-control="select" data-sortable="true">Image</th>
<th data-field="note" data-sortable="true">Link</th>
</tr>
</thead>
<tbody>
<tr>
<td class="bs-checkbox "><input data-index="0" name="btSelectItem" type="checkbox"></td>
<td>Maths Tution</td>
<td>$20</td>
<td><img src="https://i.imgur.com/0GoaYKd.jpg" height="100" width="100"></td>
<td><a href="https://monsoonmalabar.com/sonyshop/other/product-13/">Go</a></td>
</tr>
<tr>
<td class="bs-checkbox "><input data-index="1" name="btSelectItem" type="checkbox"></td>
<td>Milk</td>
<td>$5</td>
<td><img src="https://i.imgur.com/2ZOroMI.jpg" height="100" width="100"></td>
<td><a href="https://monsoonmalabar.com/sonyshop/test_category_2/product-6/">Go</a></td>
</tr>
</tbody>
</table>
</div>
Here is the link to the website, https://www.monsoonmalabar.com/aggregate_search
How to render the html here?
答案1
得分: 0
在你的table
标签中添加data-escape="false"
,Bootstrap Table将不会转义HTML标签。
链接:https://bootstrap-table.com/docs/api/table-options/#escape
英文:
Bootstrap Table escapes HTML tags. Add data-escape="false"
in your table
tag.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论