嗨,我有这段代码,我正在尝试检测每个克隆去哪个 div。
$(function() {
$('#draggableImages img').draggable( {
helper: "clone",
containment: '#dropbox',
cursor: 'move',
revert: 'invalid'
})
$("#Sunday").droppable({
drop: function(event, ui) {
if (ui.draggable[0].id) {
$(this).append($(ui.helper).clone().draggable());
}
}
});
.
.
.
$("#Saturday").droppable({
drop: function(event, ui) {
if (ui.draggable[0].id) {
$(this).append($(ui.helper).clone().draggable());
}
}
});
我的 div 检查在这里不起作用,这就是我尝试的方式。这是我认为单击按钮时应检测到克隆的部分
$( '#Checkdiv input[type=button]' ).click(function(){
if($("#Monday:has(camera)").length > 0){
alert("Camera");
}
else if($("#Monday:has(star)").length > 0){
alert("star");
}
else{
alert("no");
}
});
});