jQuery .sortable is not a function

jQuery UI and jQuery must be loaded in a certain order:

<script src="jquery.js">...
<script src="jquery-ui.js">...

Make sure you are including jQuery UI after jQuery.


So not sure if this will help anyone, but I ran into a similar situation, which I was able to solve. So this seems to happen when either

a) the order of loading jQuery-ui and jQuery is wrong.

b) jQuery is being included more than once, or different versions are being included.

Option "b" happened to me because I was using a bootstrap template, where jQuery is included at the bottom of the document, which is of course a best practice, while the code I was testing added a different version of jQuery at the top of the page.

I see that the code on this question looks like it contains a number of duplicates, so I would suggest cleaning it up as a start.