user419017
user419017

Reputation:

jquery droppable 'drop' event help

What I'm essentially doing is creating a list item on drop. Using the drop event I'm then doing some other fancy stuff with the list. The trouble is, on drop - the item is not created yet.

$("#drop").droppable({  
    drop: function(ev, ui) {
      alert($(this).siblings().length);
    }

If you have 4 items, it will report 4 even when you just dropped a 5th item in. Is there another event? Or perhaps using a setTimeout which I've used before with some success. I checked the other events but I can't see anything which will trigger after the element is dropped.

Upvotes: 1

Views: 505

Answers (1)

brain
brain

Reputation: 2517

If you want to just access the draggable element, you use ui.draggable.

If you need to update the list and such, it's likely that you need to use setTimeout.

Upvotes: 1

Related Questions