Got error TypeError: $ is not a function

Got error TypeError: $ is not a function

gbmapogbmapo Posts: 17Questions: 6Answers: 0

Just added Datables to a Drupal 8 site and tried to use it on View formatted as a table (of course). My settings seem correct: in the generated html, I get this:

    <head>
    some Drupal CSS stuff 
        <script src="/core/assets/vendor/modernizr/modernizr.min.js?v=3.3.1">
        </script>
        <script src="/core/assets/vendor/jquery/jquery.min.js?v=3.2.1">
        </script>
        <script src="/libraries/DataTables/datatables.min.js?v=1.x">
        </script>
        <script src="/modules/custom/association/js/LoM.js?v=1.x">
        </script>
    </head>
    <body>
    <div>
        other Drupal stuff (menus, theme regions...) 
        <div class="view-content">
            <table class="views-table views-view-table cols-8 sticky-enabled" id="ListOfMembers">
                <thead>...</thead>
                <tbody>...</tbody>
            </table>
        </div>
    </div>
    Other Drupal javascript stuff 
    </body>

In LoM.js, I have coded this:

$(document).ready(function() {
    $('#ListOfMembers').DataTable();
} );

So jquery, datables and my initialization seem to be loaded in the right order.
But nothing happens and when I go to the browser console, I get this error:

Any idea why?

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.