Some time ago i searched for a way to limit elements on a sortable box (i used jQuery Interface). For example, i had two boxes and one of them needs no more than three items. After i searched and switch net upside down, i ask directly to the creator or Interface and he gave me a simple (but still efficient) solution:
$('.sort').Sortable({
accept : 'sortItem',
activeclass : 'sortableactive',
hoverclass : 'sortablehover',
helperclass : 'sorthelper',
opacity: 0.5,
fit : false,
floats: true,
onStart: function(){
console.log($('#big .sortItem').size())
if ($('#big .sortItem').size() == 3) { //max of items
console.log($('#big').get(0).dropCfg.a)
$('#big').get(0).dropCfg.a = 'dummyRandom';
} else {
$('#big').get(0).dropCfg.a = 'sortItem';
}
}
});
Demo here (click!).