Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery .sortable is not a function [duplicate]

Even though I've followed the directions in the jQuery UI documentation, I'm getting the error that .sortable is not a function.
Here is my code:

<div style="float: left;">
    <span class="caption" style="width: 255px; display: block;">
        Assigned Limits
    </span>
    <div class="assigned-limit-box">
        <ul id="limAssigned" class="ul-base">
        </ul>
    </div>
</div>

This is my js:

$('#limAssigned').sortable();

My jQuery js is loaded before my jQuery UI js.

What am I doing wrong?

like image 960
Robyn Paxton Avatar asked Aug 31 '25 05:08

Robyn Paxton


2 Answers

I had the same issue when a page using the sortable() function was required by a main php page. Adding the following code within the head of the main page wasn't sufficient. Adding it also at the beginning of the required page (inside the body in my case) fixed everything.

<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
like image 79
user3279807 Avatar answered Sep 02 '25 19:09

user3279807


I figured it out. The page that I needed sortable for is loaded into a div within my main page. I had to add the jQuery UI script to that jsp rather than the main page jsp. Funny how that worked out.

like image 29
Robyn Paxton Avatar answered Sep 02 '25 19:09

Robyn Paxton