jQuery UI, droppable , accept maximum number of elements
is there any way to set the maximum elements the drop target can accept ?
an开发者_开发问答d is there any standard way to list all the dropped items ??
thanks
Just use a counter on the drop event to disable the droppable when the limit is reached:  
$(function() {
    var limit = 5;
    var counter = 0;
    $('.drag').draggable({revert: "invalid"});
    $('.drop').droppable({
        drop: function() {
            counter++;
            if (counter == limit) {
                alert('limit reached!');
                $(this).droppable("disable");
            }
        }
    });
});
Example link. Please note that this is only a demo, you may probably need to use accept and scope options.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论