如何在同一页面中实现多个dataTable?

时间:2018-03-28 10:31:14

标签: javascript jquery html datatable

我正在开发一个项目,需要在同一页面上有多个数据表。  我尝试了两种使用以下提到的代码的方法:

 $('table.display').DataTable();
 $('#example').DataTable();

但它不起作用,任何人请提前帮助我。

1 个答案:

答案 0 :(得分:0)

看来你是初学者,你想在你的html页面上创建一个或多个表,对吗?

您只需使用<table>标记即可创建表格。您可以使用<tr>创建行,使用<td>创建列(或单元格)。

例如,

table, th, td {
    border: 1px solid black;
    border-collapse: collapse;
}
th, td {
    padding: 5px;
    text-align: left;    
}
<table style="width:100%">
  <tr>
    <th>Name:</th>
    <td>Bill Gates</td>
  </tr>
  <tr>
    <th rowspan="2">Telephone:</th>
    <td>55577854</td>
  </tr>
  <tr>
    <td>55577855</td>
  </tr>
</table>

这是开始学习表格的好地方:https://www.w3schools.com/html/html_tables.asp

相关问题