我的代码是这样的:
HTML:
<div class="content">
box 1 (Customer)
<ol class='example limited_drop_targets default vertical'>
<li>Valentino Rossi<ol></ol></li>
<li>David Beckham<ol></ol></li>
<li>Eden Hazard<ol></ol></li>
</ol>
</div>
<div class="content">
box 2 (Room Type)
<ol class='example limited_drop_targets default vertical'>
<li>Single Room<ol></ol></li>
<li>Double Room<ol></ol></li>
<li>Family Room<ol></ol></li>
</ol>
</div>
Javascript:
$(function () {
$("ol.example").sortable();
});
演示/完整代码如下:https://jsfiddle.net/oscar11/x0q81hfq/
我从这里带走:https://johnny.github.io/jquery-sortable/
将元素从框1拖放到框2不起作用
我在文档中查找代码不存在
如何使用可排序的jQuery将元素从框1拖放到框2?
非常感谢你
最佳答案
我们首先访问该插件的示例页面,并查看是否可以找到有助于说明该插件是否支持您所寻找的功能的文档。
After a quick look we fine can pass in a "group" which accepts class so you're code changes like so:
$(function() {
$("ol.example").sortable({
group: '.example'
});
});
关于javascript - 如何使用可排序的jQuery将元素从框1拖放到框2?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/34755908/