Many jQuery UI options

see this demo from jquery ui you need to hold the Ctrl key to make several choices I really like the code, but I don’t want to force my visitor to press the ctrl key I want the code to allow multiple choices without holding the Ctrl key

Is it possible?

+3
source share
2 answers

I asked you questions in the comments, but I will just write a simple solution for choosing so you can see what I was thinking.

, jquery toggle(), . , , , .

$(document).ready( function() {
    $('ul#selectable li').toggle( function() {
        $(this).addClass('orange'); }, function() {
        $(this).removeClass('orange'); } );
});

- li . , , , li , .

, text() " ".

var theSelections = new Array();

$('ul#selectable li[class$="orange"]').each( function(i) {
    theSelections[i] = $(this).text();
});
+5

. , . .

a.selectable('Enable') .

.selectable('toggle') onClick .

.

-1

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


All Articles