javascriptjqueryjquery-uijquery-ui-sortablecontainment

issues with .sortable function in J query


Here is a JSfiddle I'm working with.

I'm trying to create two lists from which I can move each item in and out between them and changes will update below inside the update function / sort status div area.

My first alert on line 3 works but when I call the click function on line 5 line 6 alert doesn't work. Overall I think my code may be missing something or a semi colon etc. is out of place. Please help and leave feedback, thanks.

$(document).ready(function() {
 alert(0);
 $(".shopping_list").onclick(function() {
    alert(1);
    $("#names #places").sortable({
         containment: 'parent', 
        tolerance: 'pointer',
        cursor: 'pointer', 
        revert: true, 
        opacity: 0.60,
        connectWith:"#names #places",
        update: function(event, ui) {
             content = $(this).text();
              $('#sort_status').text(content);
        }
    })

 });
});

Solution

  • Like grissom pointed out in his answer and comments,

    Other than that:

    Demo