How to cause a crash in jQuery?

$(item).droppable({
    drop: function(event, ui) {
        console.log("triggered");
    }
});

I'm trying to call drop

$(item).trigger("drop", [{},{draggable : $(target_item)}]);

But it doesn’t work, any ideas?

+3
source share
2 answers

Perhaps what you want to do:

$(item).bind('dropthis', function(e){
        console.log('triggered');
}).droppable({
    drop: function(event, ui) {
        $(this).trigger('dropthis',[event, ui]);
        }
});

And raise the drop event:

$(item).trigger("dropthis", [{},{draggable : $(target_item)}]);
0
source

try jQuery.simulate plugin

Something like this should work.

var dropZone = $("#dropZone").offset() //get dropZone offset object
$("#dragableEle").simulate("drag", {
     dx: dropZone.left, // move to this x
     dy: dropZone.top, // move to this y
     speed:5000 // set speed
});
0
source

Source: https://habr.com/ru/post/1740040/


All Articles