Alex
Alex

Reputation: 68492

jQuery droppable bind function on element drop?

How can I bind a function on the drop event, but outside of the droppable() function?

$('#list').droppable({
    // ...      
    drop: function(e,ui) {
       // this works...
    },
});


// ..but I want to bind my function here

Is this possible?

Upvotes: 6

Views: 3688

Answers (1)

Interrobang
Interrobang

Reputation: 17434

Yes, absolutely. Bind to the "drop" event as you would any other event.

$( "#list" ).bind( "drop", function(event, ui) {
  ...
});

Upvotes: 5

Related Questions