Jquery ui selectable checkbox

I have two questions. I am using jquery selectable ui for checkbox.

http://jsfiddle.net/skeR4/4/

1.) How can I change the script, so when I click another <li> it also selects this element, and does not deselect the previously selected one. and to deselect an item, the user will override the item. in this way, the user can select multiple items by clicking each separately without using ctrl + click to select multiple.

 <div class="demo"> <ol id="selectable"> <li class="ui-state-default">1<input type="checkbox" value="something"></li> <li class="ui-state-default">2</li> <li class="ui-state-default">3</li> <li class="ui-state-default">4</li> </ol> </div><script> $(function() { $( "#selectable" ).selectable(); }); </script> 
+4
source share
1 answer
  $("#selectable").bind("mousedown", function(e) { e.metaKey = true; }).selectable(); 

Demo

+6
source

Source: https://habr.com/ru/post/1413111/


All Articles