开发者

jquery droppable 'drop' event help

开发者 https://www.devze.com 2023-04-05 03:27 出处:网络
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.

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 a开发者_运维问答nything which will trigger after the element is dropped.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号