JQuery UI dropbar akzeptieren maximale Anzahl von Elementen

$(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");
            }
        }
    });
});
Embarrassed Eagle