m4olivei
m4olivei

Reputation: 566

How can I provide user feedback when a draggable is rejected by a droppable?

jQuery 1.3 jQuery UI 1.7.2

I have an application where there are a number of droppable divs that accept only a single draggable. I do this by setting the accept option on all my droppable's to a function that check for a valid draggable and if it is already occupied. If it is occupied, the accept function returns false, else it returns true. Thus if a user tries to drop a draggable on a droppable that is already occupied, the draggable reverts.

What I would like to do is provide additional feedback when a user drops a draggable on top of an occupied droppable. Any idea how I can do this?

Upvotes: 0

Views: 339

Answers (1)

Baloneysammitch
Baloneysammitch

Reputation: 701

Why not do this with a class? Set the parent item with the class 'full' when you drop the dragged element. Then you could do something like:

if($this).hasClass('full'))
    //Alert user it is full

Upvotes: 0

Related Questions