如何定位在mousedown和mousemove上动态创建的div然后在mouseup上删除?
我试图像这样定位它:
$ ('div').on('remove', '.ui-draggable-dragging', function(e){
console.log('hello world');
});
只有当另一个js脚本创建一个框时,才会发生此div。谢谢你的帮助。
答案 0 :(得分:0)
试试这个。如果.ui-draggable-dragging
是动态创建的,则您需要在执行任何操作之前搜索body
:
$('body').on('remove', '.ui-draggable-dragging', function (e) {
console.log('hello world');
});
答案 1 :(得分:0)
您应该尝试检查DOM中更高元素的更改,如
$('body').on( 'change', '#container', function() {
dowhatyouneed();
}):