jQuery .sortable is not a function

匿名 (未验证) 提交于 2019-12-03 02:29:01

问题:

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?

回答1:

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> 


回答2:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!