2010-11-08 131 views

回答

4

您可以只使用selectingunselecting事件对于这一点,例如:

$("#selectable").selectable({ 
    selecting: function(event, ui) { 
     $(ui.selecting).find(':checkbox').attr('checked', true); 
    }, 
    unselecting: function(event, ui) { 
     $(ui.unselecting).find(':checkbox').attr('checked', false); 
    } 
}); 

You can test it here, with the checkboxes visible to see it working,并here's that same version with just some added styling to hide the checkboxes

虽然,如果您在进行AJAX提交,check out the serialize demo表明您可以从元素中获取任何值,但它不一定是实际的输入元素。

+0

嗨尼克,太棒了,这正是我期望能够做到的。非常感谢。 – 2010-11-09 08:04:42