好的,所以我正在尝试集成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 ) );
});
}
});
});
答案 0 :(得分:0)
尝试:
$(function() {
$( "#selectable" ).selectable({
stop: function() {
var result = $( "#select-result" ).empty();
$( ".ui-selected").each(function() {
var index = $( this ).attr('id');
result.append( "#" + ( index + 1 ) );
});
}
});
});