Other solution is to add next code below "...drop: function(){..."
$(this).droppable('disable'); logicaly, it will disable drop on element... If you want enable drop, again, add next code below "...out: function (event, ui) {..." $(this).droppable('disable'); Hope it helps... On Sep 8, 3:27 am, "Richard D. Worth" <rdwo...@gmail.com> wrote: > The accept option can take a function. That function gets called when a > draggable starts being dragged and the draggable item is sent as the first > argument to the function. So if your droppable already has an item, simply > return false in that function, otherwise return true. The other option would > be to disable or destroy your droppable, once it has an item. > - Richard > > On Sat, Sep 5, 2009 at 10:16 AM, pEeLL <milan.h...@gmail.com> wrote: > > > Hi > > > i use for drag and drop this easy code > > > $(function() { > > > $(".ui-draggable").draggable({ revert: 'invalid' }); > > > $(".ui-droppable").droppable({ > > accept: '.ui-draggable', > > drop: function(event, ui) { > > $(this).addClass('red'); > > }, > > out: function(event, ui) { > > $(this).removeClass('red'); > > } > > }); > > }); > > > i have some boxes and some containers. i want add ONLY one box to one > > container. How can i limit number of boxex that will container > > accept? thanks for every help.