Monday, January 16, 2012

jQuery Sortable UI Syntax Issue


Im not quite sure what to search for to sort out this problem.



I am getting syntax error with the following code because i have 2 (no idea what to call them) in the .sortable options. Would you be able to tell me what i have done wrong with this code?



Im using a placeholder and also a connectWith from this page http://jqueryui.com/demos/sortable/#portlets and there doesnt seem to be any examples showing how to write both of them at the same time.



The syntax error is not there when i comment out




placeholder: "placeholder-highlighting"



or




connectWith: ".sortable-content"



My code is below:




$(function() {
$( ".sortable-content" ).sortable({
placeholder: "placeholder-highlighting"
connectWith: ".sortable-content"
});
$( ".sortable" ).disableSelection();
});



Bonus points for telling me what they are called!

1 comment:

  1. They are called options. You are calling the "sortable" method and then saying "use these options instead of the default options (if there are any)".

    You need to put a comma between each option!

    $(function() {
    $( ".sortable-content" ).sortable({
    placeholder: "placeholder-highlighting",
    connectWith: ".sortable-content"
    });
    $( ".sortable" ).disableSelection();
    });

    ReplyDelete