Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/405.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 不同无序列表之间的jQuery可排序_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 不同无序列表之间的jQuery可排序

Javascript 不同无序列表之间的jQuery可排序,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有多个无序列表,每个UL最多有2个列表元素 我的dom结构如下所示: <div class="wrapper"> <ul class="question" data-index="0"> <li class="answer1" data-index="0"> <li class="answer2" data-index="0"> </ul> <ul class="question" data-in

我有多个无序列表,每个UL最多有2个列表元素

我的dom结构如下所示:

<div class="wrapper">
  <ul class="question" data-index="0">
    <li class="answer1" data-index="0">
    <li class="answer2" data-index="0">
  </ul> 

  <ul class="question" data-index="1">
    <li class="answer1" data-index="1">
    <li class="answer2" data-index="1">
  </ul> 

  <ul class="question" data-index="2">
    <li class="answer1" data-index="2">
    <li class="answer2" data-index="2">
  </ul>
</div> 
但很明显,我只允许我在它自己的无序列表中订购李。我是否可以将列表元素上的sortable称为它自己


编辑:我应该添加每个UL只能有2个列表元素签出。您可以查看演示并查看源代码,这样您就可以根据项目的需要实现它。

我想您正在寻找类似的东西


这很有效。但我唯一的问题是,我只能允许每个ul使用2 li元素
$('.wrapper .question').sortable();