Here is a variation of Alex R’s code working with multiple elements
function SelectSelectableElements (selectableContainer, elementsToSelect)
{
// add unselecting class to all elements in the styleboard canvas except the ones to select
$(".ui-selected", selectableContainer).not(elementsToSelect).removeClass("ui-selected").addClass("ui-unselecting");
// add ui-selecting class to the elements to select
$(elementsToSelect).not(".ui-selected").addClass("ui-selecting");
// trigger the mouse stop event (this will select all .ui-selecting elements, and deselect all .ui-unselecting elements)
selectableContainer.data("selectable")._mouseStop(null);
}
Update:
jQueryUI 1.10, per comments from kmk: http://jsfiddle.net/XYJEN/163/