jQuery ui droppable menerima jumlah maksimum elemen

$(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