DataTablesScripts.js:43 Uncaught TypeError: $(...).DataTable is not a function

DataTablesScripts.js:43 Uncaught TypeError: $(...).DataTable is not a function

RSmithBothellRSmithBothell Posts: 7Questions: 3Answers: 0

I finally have other errors out of the way, yet this still is happening.

You'll see console errors, but the 'missing' scripts are in the javascript window.

The script for list_plan_levels.html, (the core html of the page w/ the DataTable()), is mostly commented out. Just:
$('#UpDownGrade').DataTable() ;
is active.

sa my JS Bin here: https://jsbin.com/hazifu/edit?html,js,console,output

I have been stuck on this for two weeks now; any help would be MUCH appreciated.

Answers

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    $(Main);

    I'm not sure what your goal is with that? Main looks like a function (although mixing JS in the Javascript and HTML views doesn't really work in JSBin).

    You have similar calls to $(LeftMargin). I don't get why you'd want to pass a function into jQuery?

    Allan

  • RSmithBothellRSmithBothell Posts: 7Questions: 3Answers: 0

    Hi Allen,

    I'm keeping all JS, PHP, and HTML in their own files.
    $(Main) is how I'm invoking function Main(){} in the javascript file.
    It is a shortcut for $(document).ready(Main) ;
    At least, that's what I interpreted from jquery.net...

    The alternative would be to put at the very end of the HTML, (after of course including the source as I do at top).
    <script> Main() </script>

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    It is a shortcut for $(document).ready(Main) ;

    That I didn't know! jQuery docs confirming it. Thanks :smile:.

    I'm getting lots of errors in the jsbin your linked to such as:

    Uncaught ReferenceError: Main is not defined

    Did you try moving all of your Javascript into the JavaScript panel to let the example run?

    Allan

This discussion has been closed.