jQuery live and sortable

前端 未结 1 944
我寻月下人不归
我寻月下人不归 2021-01-23 02:44

I have the following static html:

  • Item 10
相关标签:
1条回答
  • 2021-01-23 03:22

    .live() is event based, so you can't use it for plugins like this. What you can easily do is call that code when your AJAX call finishes, for example:

    $.ajax({
     //options...
      success: function(data) {
        //create UL
        $("#mylist").sortable({axis:"y"});
      }
    });
    

    The same goes for short forms of $.ajax(), for example:

    $("#mylist").load("pageThatGivesTheLIElementGoodness.htm", function() {
      $(this).sortable({axis:"y"});
    })
    
    0 讨论(0)
提交回复
热议问题