Image and link are not rendering inside HTML table.

huangapple go评论70阅读模式
英文:

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.


&lt;table id=&quot;table&quot; 
data-toggle=&quot;table&quot;
data-search=&quot;true&quot;
data-filter-control=&quot;true&quot; 
data-show-export=&quot;true&quot;
data-show-refresh=&quot;true&quot;
data-show-toggle=&quot;true&quot;
data-pagination=&quot;true&quot;
data-toolbar=&quot;#toolbar&quot;
class=&quot;table-responsive&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th data-field=&quot;state&quot; data-checkbox=&quot;true&quot;&gt;&lt;/th&gt;
&lt;th data-field=&quot;prenom&quot; data-filter-control=&quot;input&quot; data-sortable=&quot;true&quot;&gt;Title&lt;/th&gt;
&lt;th data-field=&quot;date&quot; data-filter-control=&quot;select&quot; data-sortable=&quot;true&quot;&gt;Price&lt;/th&gt;
&lt;th data-field=&quot;examen&quot; data-filter-control=&quot;select&quot; data-sortable=&quot;true&quot;&gt;Image&lt;/th&gt;
&lt;th data-field=&quot;note&quot; data-sortable=&quot;true&quot;&gt;Link&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;bs-checkbox &quot;&gt;&lt;input data-index=&quot;0&quot; name=&quot;btSelectItem&quot; type=&quot;checkbox&quot;&gt;&lt;/td&gt;
&lt;td&gt;Maths Tution&lt;/td&gt;
&lt;td&gt;$20&lt;/td&gt;
&lt;td&gt;&lt;img src=&quot;https://i.imgur.com/0GoaYKd.jpg&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://monsoonmalabar.com/sonyshop/other/product-13/&quot;&gt;Go&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;bs-checkbox &quot;&gt;&lt;input data-index=&quot;1&quot; name=&quot;btSelectItem&quot; type=&quot;checkbox&quot;&gt;&lt;/td&gt;
&lt;td&gt;Milk&lt;/td&gt;
&lt;td&gt;$5&lt;/td&gt;
&lt;td&gt;&lt;img src=&quot;https://i.imgur.com/2ZOroMI.jpg&quot; height=&quot;100&quot; width=&quot;100&quot;&gt;&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://monsoonmalabar.com/sonyshop/test_category_2/product-6/&quot;&gt;Go&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

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=&quot;false&quot; in your table tag.

https://bootstrap-table.com/docs/api/table-options/#escape

huangapple
  • 本文由 发表于 2023年2月16日 14:49:28
  • 转载请务必保留本文链接:https://go.coder-hub.com/75468713.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定