Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI Selectable - unselect selected item on click

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 selected, unselect it, otherwise do the default behavior.

Thanks.

like image 668
fehays Avatar asked Oct 15 '10 21:10

fehays


1 Answers

i'm very late in responding to your question, but let me just answer it anyway so that to keep it as a reference for others.

$( ".selector" ).bind( "mousedown", function ( e ) {
    e.metaKey = true;
} ).selectable();

this will allow the toggle behavior that you're looking for.

like image 123
Keith Socheath Chea Avatar answered Oct 02 '22 17:10

Keith Socheath Chea