Datatables not working

Datatables not working

rajmalhotrarajmalhotra Posts: 3Questions: 1Answers: 0

I have a very simple html file, but I see only plain text data after the following code. I don't see any error in the console too.

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Show Policies</title>

    <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css">
    <script src="https://code.jquery.com/jquery-3.3.1.js"></script>
    <script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.js"></script>

    <script type="text/javascript">
        $(document).ready( function () {
            $('#table_id').DataTable();
        } );
    </script>
</head>

<body>
<table id="#table_id" class="display">
    <tbody>
    <tr th:each="customers : ${policies}">
        <td th:text="${customers.id}"></td>
        <td th:text="${customers.type}"></td>
        <td th:text="${customers.name}"></td>
        <td th:text="${customers.description}"></td>
    </tr>

    </tbody>

</table>
</body>
</html>

Answers

This discussion has been closed.