-2

好的,所以我正在尝试集成可选的jQuery UI插件(网格),我喜欢它如何将选定的索引发布回来。这是我想做的事情:

$(function() {
    $( "#selectable" ).selectable({
        stop: function() {
            var result = $( "#select-result" ).empty();
            $( ".ui-selected").each(function() {
                 var index = $( "#selectable li" ).attr('id');
                                   // But I want the ids of all the selected elements,
                                   // but the id of the first is just getting copied on my site!
                result.append( "#" + ( index + 1 ) );
            });
        }
    });
});
4

1 回答 1

0

尝试:

$(function() {
    $( "#selectable" ).selectable({
        stop: function() {
            var result = $( "#select-result" ).empty();
            $( ".ui-selected").each(function() {
                 var index = $( this ).attr('id'); 
                result.append( "#" + ( index + 1 ) );
            });
        }
    });
});
于 2011-11-03T00:34:03.993 回答