I'm trying to use datatables (for the first time) to format a simple table. I'm getting the following error in the web browser console:
$('#example').DataTable is not a function
I'm loading the html from a local file if that makes any difference. It looks like I have all the JS libraries that I need so I'm not sure why I'm running into this error. Do you know why it can't find this symbol?
<head>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://cdn.datatables.net/2.2.2/js/dataTables.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/2.2.2/css/dataTables.dataTables.min.css"/>
<script>
$(document).ready(function() {
$('#example').DataTable();
})
</script>
</head>
<table id="example" class="display">
<thead>
<tr>
<th>Symbol</th>
<th>Name</th>
<th>Price</th>
<th>Market Cap</th>
</tr>
</thead>
<tbody>
<tr>
<td>A</td>
<td>AGILENT TECHNOLOGIES INC COM</td>
<td>108.91</td>
<td>31865650170.0</td>
</tr>
<tr>
<td>AA</td>
<td>ALCOA CORP COM</td>
<td>26.9</td>
<td>4800278100.0</td>
</tr>
</tbody>
</table>
Update - I saw the error when using Safari. When it tried it with Chrome it worked correctly.