How to programmatically select selectables with jQuery UI?

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

    // trigger the mouse stop event (this will select all .ui-selecting elements, and deselect all .ui-unselecting elements)"selectable")._mouseStop(null);


jQueryUI 1.10, per comments from kmk:

Leave a Comment