Hoa
Hoa

Reputation: 20438

Why does jQuery give me an error 'has no method sortable'?

I have a fiddle here

http://jsfiddle.net/WULsZ/1/

I load jQuery first and the code is pretty much straight from the sample so I'm puzzled as to why I'm getting an error

Upvotes: 4

Views: 3498

Answers (2)

Jasper
Jasper

Reputation: 76003

Demo: http://jsfiddle.net/WULsZ/3/

You have to include jQuery Core, then jQuery UI.

<script src="http://dl.dropbox.com/u/12337149/jquery.js"></script>
<script src="http://dl.dropbox.com/u/12337149/jquery-ui.js"></script>

If you include jQuery UI it will try to extend the jQuery Core, and if you include jQuery Core it will overwrite any previous instance of jQuery Core (including the extended jQuery UI code).

Documentation: http://learn.jquery.com/jquery-ui/getting-started/

Upvotes: 9

Tats_innit
Tats_innit

Reputation: 34107

Here you go working demo: http://jsfiddle.net/WULsZ/7/

Hope this helps, cheers

Missing:

  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

Jquery Code

$(function () {
    $("#sortable").sortable();
    $("#sortable").disableSelection();
});​

Upvotes: 2

Related Questions