您的问题丢失,并且您的ID包含来自
id="myDataTable "
到
id="myDataTable"
$("#myDataTable").DataTable();
并将tr改为thead作为表头
<thead>
<th>EmployeeName</th>
<th>DepartmentName</th>
<th>Salary</th>
</thead>
$(document).ready(function () {
$("#myDataTable").DataTable();
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<html>
<head>
<link href="bootstrap.css" rel="stylesheet" type="text/css"/>
<link href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" language="javascript" src="bootstrap.js"></script>
</head>
<body>
<div class="panel panel-body">
<div class="col-md-9">
<table id="myDataTable" class="display">
<thead>
<th>EmployeeName</th>
<th>DepartmentName</th>
<th>Salary</th>
</thead>
<tbody>
<tr>
<td>Noosh</td>
<td>Psian</td>
<td>1000</td>
</tr>
<tr>
<td>Nil</td>
<td>AD</td>
<td>2000</td>
</tr>
<tr>
<td>Neg</td>
<td>Amatis</td>
<td>3000</td>
</tr>
<tr>
<td>Neg2</td>
<td>Amatis</td>
<td>3000</td>
</tr>
<tr>
<td>Neg3</td>
<td>Amatis</td>
<td>3000</td>
</tr>
<tr>
<td>Neg1</td>
<td>Amatis</td>
<td>3000</td>
</tr>
</table>
</div>
</div>
</body>
</html>