jQuery UI Selectable - unselect selected item on click

前端 未结 4 1845
南方客
南方客 2020-12-24 15:24

Does anyone know if there\'s a way to configure a jquery ui selectable element to unselect the selected element when you click it? Sort of like a toggle. If it\'s already

4条回答
  •  情深已故
    2020-12-24 15:52

    Is this what you mean?

    This event is triggered at the end of the select operation, on each element removed from the selection.

    Code examples

    Supply a callback function to handle the unselected event as an init option.

    $( ".selector" ).selectable({
       unselected: function(event, ui) { ... }
    });
    Bind to the unselected event by type: selectableunselected.
    $( ".selector" ).bind( "selectableunselected", function(event, ui) {
      ...
    });
    

    Source:

    http://jqueryui.com/demos/selectable/#event-unselected

提交回复
热议问题