I have a list containing different some elements. I want all to be selectable, but only in groups. Like:
<ul>
<li rel="group1">Item 1</li>
<li rel="group1">Item 2</li>
<li rel="group2">Item 3</li>
<li rel="group2">Item 4</li>
<li rel="group3">Item 5</li>
<li rel="group3">Item 6</li>
</ul>
I wrote something that could work, but I don't know how to cancel current selection if current's element rel attribute is different to first chosen.
var selected = null;
$( "#selectable" ).selectable({
selecting: function(event, ui) {
if (!selected)
selected = $(ui.selecting).attr('rel');
if (selected != $(ui.selecting).attr('rel')){
// cancel this selection
}
}
});