Jquery可拖动禁用列表项在被放入其他div后
我想,如果从products div和drop in cart div中拖动任何列表项(li),则li将被禁用,用户无法在cart div中再次添加它Jquery可拖动禁用列表项在被放入其他div后,jquery,draggable,droppable,Jquery,Draggable,Droppable,我想,如果从products div和drop in cart div中拖动任何列表项(li),则li将被禁用,用户无法在cart div中再次添加它 jQuery("#product li").draggable({ appendTo: "body", helper: "clone" }); jQuery("#cart ol").droppable({ activeClass: "ui-state-default", hoverClass: "ui-state
jQuery("#product li").draggable({
appendTo: "body",
helper: "clone"
});
jQuery("#cart ol").droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
accept: ":not(.ui-sortable-helper)",
drop: function (event, ui) {
$(this).find(".placeholder").remove();
$("<li></li>").text(ui.draggable.text()).appendTo(this);
}
});
jQuery(“#产品li”).draggable({
附:“身体”,
助手:“克隆”
});
jQuery(“#cart ol”).可拖放({
activeClass:“ui状态默认值”,
hoverClass:“ui状态悬停”,
接受:“:非(.ui可排序帮助程序)”,
drop:函数(事件、用户界面){
$(this.find(“.placeholder”).remove();
$(“”).text(ui.draggable.text()).appendTo(this);
}
});
您可以禁用可拖动属性,如下所示
$( "#cart li").draggable({disabled:true});
在drop函数中添加:
ul.dragged.draggable({disabled:true});
我只想禁用特定的li,而不是所有的项目?@user3243439说明您需要显示您的代码..如何在不知道DOM位置的情况下编写选择器购物车div id是什么?请尝试上面的编辑。。。如果它出现任何错误,请告诉我,如
无法在应用该属性之前禁用该属性